summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/mmap.cc
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2017-01-30 19:53:18 -0800
committerSam Bingner <sam@bingner.com>2019-08-17 12:47:30 -1000
commit41b198d29dad98dd19d46818a83cd717cdfb7411 (patch)
tree3fdbfa2b95a705cebb72efe529f1a69b1d5134ef /apt-pkg/contrib/mmap.cc
parentf1374d528f4b944c85b901e854ed26b544eed180 (diff)
It is NOT OK to just munmap memory from malloc :/.
Diffstat (limited to 'apt-pkg/contrib/mmap.cc')
-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;
}