evas/cserve2: minor fixes (error paths).

Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
This commit is contained in:
Jean-Philippe Andre 2013-06-26 11:23:35 +09:00 committed by Cedric Bail
parent d712a13a7a
commit f7c6545170
3 changed files with 14 additions and 9 deletions

View File

@ -429,6 +429,8 @@ _load_request_build(Image_Data *i, int *bufsize)
// opening shm for this file
i->shm = cserve2_shm_request(i->file->w * i->file->h * 4);
if (!i->shm)
return NULL;
shmpath = cserve2_shm_name_get(i->shm);
@ -2012,6 +2014,7 @@ cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char
ERR("file \"%s\" is in file_ids hash but not in entries hash.",
buf);
cserve2_client_error_send(client, rid, CSERVE2_INVALID_CACHE);
// FIXME: Maybe we should remove the entry from file_ids then?
return -1;
}
ref = _entry_reference_add((Entry *)entry, client, client_file_id);

View File

@ -67,6 +67,14 @@ cserve2_shm_request(size_t size)
return NULL;
}
shm = calloc(1, sizeof(Shm_Handle));
if (!shm)
{
ERR("Failed to allocate shared memory handler.");
free(map);
return NULL;
}
do {
snprintf(shmname, sizeof(shmname), "/evas-shm-img-%x-%d", (int)getuid(), id++);
fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
@ -74,6 +82,7 @@ cserve2_shm_request(size_t size)
{
ERR("Failed to create shared memory object '%s': %m", shmname);
free(map);
free(shm);
return NULL;
}
} while (fd == -1);
@ -85,6 +94,7 @@ cserve2_shm_request(size_t size)
ERR("Failed to set size of shared file: %m");
close(fd);
free(map);
free(shm);
return NULL;
}
close(fd);
@ -92,15 +102,6 @@ cserve2_shm_request(size_t size)
map->name = eina_stringshare_add(shmname);
map->length = map_size;
shm = calloc(1, sizeof(Shm_Handle));
if (!shm)
{
ERR("Failed to allocate shared memory handler.");
eina_stringshare_del(map->name);
free(map);
return NULL;
}
map->segments = eina_inlist_append(map->segments, EINA_INLIST_GET(shm));
shm->mapping = map;
shm->map_offset = 0;

View File

@ -634,6 +634,7 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key, Evas
{
ERR("Couldn't send message to server.");
free(buf);
free(fentry);
return 0;
}