summaryrefslogtreecommitdiff
path: root/src/lib/shm_du_map.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-04 20:36:40 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-04 20:36:40 +0200
commitc6983c01bcbfff43f1c705c97c041280867d539b (patch)
tree4f1efa9d852596bc9f7ca1e88f51e99ae5c76578 /src/lib/shm_du_map.c
parenta8c5a9787ba4e8757b16505409c4fbe7d7549e18 (diff)
downloadouroboros-c6983c01bcbfff43f1c705c97c041280867d539b.tar.gz
ouroboros-c6983c01bcbfff43f1c705c97c041280867d539b.zip
lib: shm_du_map: Fix memory leak
Diffstat (limited to 'src/lib/shm_du_map.c')
-rw-r--r--src/lib/shm_du_map.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c
index a12ef223..d88e5c84 100644
--- a/src/lib/shm_du_map.c
+++ b/src/lib/shm_du_map.c
@@ -182,7 +182,6 @@ struct shm_du_map * shm_du_map_create()
if (shm_base == MAP_FAILED) {
LOG_DBGF("Failed to map shared memory.");
-
if (shm_unlink(SHM_DU_MAP_FILENAME) == -1)
LOG_DBGF("Failed to remove invalid shm.");
@@ -237,6 +236,7 @@ struct shm_du_map * shm_du_map_open()
shm_fd = shm_open(SHM_DU_MAP_FILENAME, O_RDWR, 0666);
if (shm_fd < 0) {
LOG_DBGF("Failed opening shared memory.");
+ free(dum);
return NULL;
}
@@ -250,10 +250,9 @@ struct shm_du_map * shm_du_map_open()
LOG_DBGF("Failed to map shared memory.");
if (close(shm_fd) == -1)
LOG_DBGF("Failed to close invalid shm.");
-
if (shm_unlink(SHM_DU_MAP_FILENAME) == -1)
LOG_DBGF("Failed to unlink invalid shm.");
-
+ free(dum);
return NULL;
}