From cf5da1039ffb53a9ae1d789a78835b9573a95d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 10 Mar 2020 18:01:56 +0100 Subject: [PATCH] shm: mmap returns MAP_FAILED, so use that as guard value --- shm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shm.c b/shm.c index 95b7ac78..54015798 100644 --- a/shm.c +++ b/shm.c @@ -105,7 +105,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) */ int pool_fd = -1; - void *mmapped = NULL; + void *mmapped = MAP_FAILED; size_t size = 0; struct wl_shm_pool *pool = NULL; @@ -199,7 +199,7 @@ err: wl_shm_pool_destroy(pool); if (pool_fd != -1) close(pool_fd); - if (mmapped != NULL) + if (mmapped != MAP_FAILED) munmap(mmapped, size); return NULL;