]> git.saurik.com Git - apt.git/commitdiff
It is NOT OK to just munmap memory from malloc :/. cydia_1.1.28%b8
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 31 Jan 2017 03:53:18 +0000 (19:53 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 31 Jan 2017 03:53:18 +0000 (19:53 -0800)
apt-pkg/contrib/mmap.cc

index 09a3b3230f119b3848bb6f9f30a118dc63cc8ebb..f63f2eea1a9c6080d3df07c0a7e22002603e1c96 100644 (file)
@@ -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;
    }