summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-01-30 19:53:18 -0800
committerSam Bingner <sam@bingner.com>2020-07-17 00:22:23 -1000
commited465062b9615036ebbf06678339b8edf1fe1790 (patch)
tree3ed75794f08f4f98dcf8e57720316a0c057627cf /apt-pkg
parent2af52cc582ad94945e264531739fe7889dae34d0 (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 cea9ec1ee..a6414e530 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -305,10 +305,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;
}