diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-04 20:36:40 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-04 20:36:40 +0200 |
commit | c6983c01bcbfff43f1c705c97c041280867d539b (patch) | |
tree | 4f1efa9d852596bc9f7ca1e88f51e99ae5c76578 /src/lib/shm_du_map.c | |
parent | a8c5a9787ba4e8757b16505409c4fbe7d7549e18 (diff) | |
download | ouroboros-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.c | 5 |
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; } |