From c6983c01bcbfff43f1c705c97c041280867d539b Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 4 Aug 2016 20:36:40 +0200 Subject: lib: shm_du_map: Fix memory leak --- src/lib/shm_du_map.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lib') 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; } -- cgit v1.2.3