]> git.saurik.com Git - apt.git/commitdiff
Fix previous commit: Do not call memset() if realloc() returned NULL.
authorJulian Andres Klode <jak@debian.org>
Sat, 16 Jun 2012 13:23:06 +0000 (15:23 +0200)
committerJulian Andres Klode <jak@debian.org>
Sat, 16 Jun 2012 13:23:06 +0000 (15:23 +0200)
apt-pkg/contrib/mmap.cc

index 77b4502f5a4dde261f800e1de21df38ec93025b4..593bb063b9d0746a946a483efbaefdc7f825f8ee 100644 (file)
@@ -461,10 +461,11 @@ bool DynamicMMap::Grow() {
                        return false;
 
                Base = realloc(Base, newSize);
-               /* Set new memory to 0 */
-               memset((char*)Base + WorkSpace, 0, newSize - WorkSpace);
                if (Base == NULL)
                        return false;
+               else
+                       /* Set new memory to 0 */
+                       memset((char*)Base + WorkSpace, 0, newSize - WorkSpace);
        }
 
        Pools =(Pool*) Base + poolOffset;