mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-11 04:27:49 -05:00
shm: mmap returns MAP_FAILED, so use that as guard value
This commit is contained in:
parent
867dc836ab
commit
cf5da1039f
1 changed files with 2 additions and 2 deletions
4
shm.c
4
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue