]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/mmap.cc
It is NOT OK to just munmap memory from malloc :/.
[apt.git] / apt-pkg / contrib / mmap.cc
index 09a3b3230f119b3848bb6f9f30a118dc63cc8ebb..f63f2eea1a9c6080d3df07c0a7e22002603e1c96 100644 (file)
@@ -307,10 +307,11 @@ DynamicMMap::~DynamicMMap()
       if (validData() == false)
         return;
 #ifdef _POSIX_MAPPED_FILES
       if (validData() == false)
         return;
 #ifdef _POSIX_MAPPED_FILES
-      munmap(Base, WorkSpace);
-#else
-      free(Base);
+      if ((Flags & Fallback) != Fallback) {
+         munmap(Base, WorkSpace);
+      } else
 #endif
 #endif
+      free(Base);
       return;
    }
    
       return;
    }