summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-01-30 19:53:18 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2017-01-30 19:53:18 -0800
commit88ac08f98958386bb268c3c756f56a1367a7a671 (patch)
tree33be3a7723ea332ba90b0446698655f919f3b038 /apt-pkg
parent98639cb8c8b5ee0bec3449a2c3e08bc0177afc12 (diff)
It is NOT OK to just munmap memory from malloc :/.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/mmap.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 09a3b3230..f63f2eea1 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -307,10 +307,11 @@ DynamicMMap::~DynamicMMap()
if (validData() == false)
return;
#ifdef _POSIX_MAPPED_FILES
- munmap(Base, WorkSpace);
-#else
- free(Base);
+ if ((Flags & Fallback) != Fallback) {
+ munmap(Base, WorkSpace);
+ } else
#endif
+ free(Base);
return;
}