diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2017-01-30 19:53:18 -0800 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2019-08-17 12:47:30 -1000 |
commit | 41b198d29dad98dd19d46818a83cd717cdfb7411 (patch) | |
tree | 3fdbfa2b95a705cebb72efe529f1a69b1d5134ef | |
parent | f1374d528f4b944c85b901e854ed26b544eed180 (diff) |
It is NOT OK to just munmap memory from malloc :/.
-rw-r--r-- | apt-pkg/contrib/mmap.cc | 7 |
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; } |