From: Julian Andres Klode Date: Sat, 16 Jun 2012 13:23:06 +0000 (+0200) Subject: Fix previous commit: Do not call memset() if realloc() returned NULL. X-Git-Tag: 0.9.7~2 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/e3026ce49a0839dfbe494af7e60d91bc7204f88e Fix previous commit: Do not call memset() if realloc() returned NULL. --- diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 77b4502f5..593bb063b 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -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;