From 5fe9706b823cd441703239ece020e517d722d88c Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sun, 15 May 2016 15:43:47 +0200 Subject: lib: cleanup file descriptors for shared memory cleanup of file descriptors for the shared memory. also adds a missing NULL check and some invalidation in dev.c --- src/lib/shm_du_map.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib/shm_du_map.c') diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c index 71c15731..7099b265 100644 --- a/src/lib/shm_du_map.c +++ b/src/lib/shm_du_map.c @@ -199,6 +199,9 @@ void shm_du_map_close(struct shm_du_map * dum) return; } + if (close(dum->fd) < 0) + LOG_DBGF("Couldn't close shared memory."); + if (munmap(dum->shm_base, SHM_FILE_SIZE) == -1) LOG_DBGF("Couldn't unmap shared memory."); @@ -212,6 +215,9 @@ void shm_du_map_destroy(struct shm_du_map * dum) return; } + if (close(dum->fd) < 0) + LOG_DBGF("Couldn't close shared memory."); + if (munmap(dum->shm_base, SHM_FILE_SIZE) == -1) LOG_DBGF("Couldn't unmap shared memory."); -- cgit v1.2.3