summaryrefslogtreecommitdiff
path: root/src/bin/evas/evas_cserve2_shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/evas/evas_cserve2_shm.c')
-rw-r--r--src/bin/evas/evas_cserve2_shm.c19
1 files changed, 10 insertions, 9 deletions
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;