diff options
author | Julian Andres Klode <jak@debian.org> | 2012-06-16 15:23:06 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2012-06-16 15:23:06 +0200 |
commit | e3026ce49a0839dfbe494af7e60d91bc7204f88e (patch) | |
tree | 5bdf332cd9a2f549d6bddc6991999147921e1594 /apt-pkg | |
parent | 61a406f0fc9c7b1807acb2ff146db6acd18e879c (diff) |
Fix previous commit: Do not call memset() if realloc() returned NULL.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/contrib/mmap.cc | 5 |
1 files changed, 3 insertions, 2 deletions
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; |