From: Jay Freeman (saurik) Date: Tue, 31 Jan 2017 03:53:18 +0000 (-0800) Subject: It is NOT OK to just munmap memory from malloc :/. X-Git-Tag: cydia_1.1.28%b8^0 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/88ac08f98958386bb268c3c756f56a1367a7a671 It is NOT OK to just munmap memory from malloc :/. --- 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; }