summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-06-26 11:23:35 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-07-02 16:58:10 +0900
commitf7c654517053d21cbd6da63dd7545dd0eae352c3 (patch)
tree7a36126c622aa22609f2c4a9fe82db6017cca1d6 /src
parentd712a13a7a234865217a03501aebe57aad8fe30d (diff)
evas/cserve2: minor fixes (error paths).
Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/bin/evas/evas_cserve2_cache.c3
-rw-r--r--src/bin/evas/evas_cserve2_shm.c19
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c1
3 files changed, 14 insertions, 9 deletions
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index d485576c0f..bbb6ce2886 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -429,6 +429,8 @@ _load_request_build(Image_Data *i, int *bufsize)
429 429
430 // opening shm for this file 430 // opening shm for this file
431 i->shm = cserve2_shm_request(i->file->w * i->file->h * 4); 431 i->shm = cserve2_shm_request(i->file->w * i->file->h * 4);
432 if (!i->shm)
433 return NULL;
432 434
433 shmpath = cserve2_shm_name_get(i->shm); 435 shmpath = cserve2_shm_name_get(i->shm);
434 436
@@ -2012,6 +2014,7 @@ cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char
2012 ERR("file \"%s\" is in file_ids hash but not in entries hash.", 2014 ERR("file \"%s\" is in file_ids hash but not in entries hash.",
2013 buf); 2015 buf);
2014 cserve2_client_error_send(client, rid, CSERVE2_INVALID_CACHE); 2016 cserve2_client_error_send(client, rid, CSERVE2_INVALID_CACHE);
2017 // FIXME: Maybe we should remove the entry from file_ids then?
2015 return -1; 2018 return -1;
2016 } 2019 }
2017 ref = _entry_reference_add((Entry *)entry, client, client_file_id); 2020 ref = _entry_reference_add((Entry *)entry, client, client_file_id);
diff --git a/src/bin/evas/evas_cserve2_shm.c b/src/bin/evas/evas_cserve2_shm.c
index 0c31e17e34..ffaa88917b 100644
--- a/src/bin/evas/evas_cserve2_shm.c
+++ b/src/bin/evas/evas_cserve2_shm.c
@@ -67,6 +67,14 @@ cserve2_shm_request(size_t size)
67 return NULL; 67 return NULL;
68 } 68 }
69 69
70 shm = calloc(1, sizeof(Shm_Handle));
71 if (!shm)
72 {
73 ERR("Failed to allocate shared memory handler.");
74 free(map);
75 return NULL;
76 }
77
70 do { 78 do {
71 snprintf(shmname, sizeof(shmname), "/evas-shm-img-%x-%d", (int)getuid(), id++); 79 snprintf(shmname, sizeof(shmname), "/evas-shm-img-%x-%d", (int)getuid(), id++);
72 fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); 80 fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
@@ -74,6 +82,7 @@ cserve2_shm_request(size_t size)
74 { 82 {
75 ERR("Failed to create shared memory object '%s': %m", shmname); 83 ERR("Failed to create shared memory object '%s': %m", shmname);
76 free(map); 84 free(map);
85 free(shm);
77 return NULL; 86 return NULL;
78 } 87 }
79 } while (fd == -1); 88 } while (fd == -1);
@@ -85,6 +94,7 @@ cserve2_shm_request(size_t size)
85 ERR("Failed to set size of shared file: %m"); 94 ERR("Failed to set size of shared file: %m");
86 close(fd); 95 close(fd);
87 free(map); 96 free(map);
97 free(shm);
88 return NULL; 98 return NULL;
89 } 99 }
90 close(fd); 100 close(fd);
@@ -92,15 +102,6 @@ cserve2_shm_request(size_t size)
92 map->name = eina_stringshare_add(shmname); 102 map->name = eina_stringshare_add(shmname);
93 map->length = map_size; 103 map->length = map_size;
94 104
95 shm = calloc(1, sizeof(Shm_Handle));
96 if (!shm)
97 {
98 ERR("Failed to allocate shared memory handler.");
99 eina_stringshare_del(map->name);
100 free(map);
101 return NULL;
102 }
103
104 map->segments = eina_inlist_append(map->segments, EINA_INLIST_GET(shm)); 105 map->segments = eina_inlist_append(map->segments, EINA_INLIST_GET(shm));
105 shm->mapping = map; 106 shm->mapping = map;
106 shm->map_offset = 0; 107 shm->map_offset = 0;
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index b6aeba691d..404b5224f3 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -634,6 +634,7 @@ _image_open_server_send(Image_Entry *ie, const char *file, const char *key, Evas
634 { 634 {
635 ERR("Couldn't send message to server."); 635 ERR("Couldn't send message to server.");
636 free(buf); 636 free(buf);
637 free(fentry);
637 return 0; 638 return 0;
638 } 639 }
639 640