diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-12-21 08:17:57 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-12-21 08:17:57 +0200 |
commit | 9ca58064e8a10546004c9a376a63105698a72d3c (patch) | |
tree | e54bdf3bcd8fe1e7f2fb57d6eca06605e9c3b47e | |
parent | 46aeea15845301873e1e7f7ed6d609a9631c2486 (diff) | |
download | gdbm-9ca58064e8a10546004c9a376a63105698a72d3c.tar.gz gdbm-9ca58064e8a10546004c9a376a63105698a72d3c.tar.bz2 |
Minor fix
* src/mmap.c (_gdbm_internal_remap): Avoid munmapping NULL pointer.
Make sure mapped_region isn't a dangling pointer.
-rw-r--r-- | src/mmap.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -82,7 +82,11 @@ _gdbm_internal_remap (GDBM_FILE dbf, size_t size) int flags = PROT_READ; size_t page_size = sysconf (_SC_PAGESIZE); - munmap (dbf->mapped_region, dbf->mapped_size); + if (dbf->mapped_region) + { + munmap (dbf->mapped_region, dbf->mapped_size); + dbf->mapped_region = NULL; + } dbf->mapped_size = size; if (size == 0) |