inline operator void *() {return Base;};
    inline void *Data() {return Base;}; 
    inline unsigned long Size() {return iSize;};
+   inline void AddSize(unsigned long const size) {iSize += size;};
    
    // File manipulators
    bool Sync();
 
       marker could be lost later by the removal of rdepends (Closes: #612557)
   * methods/rred.cc:
     - read patch into MMap only if we work on uncompressed patches
+    - update size of dynamic MMap as we write in from the outside
   * apt-pkg/contrib/mmap.cc:
     - do not try to free the mapping if its is unset
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 12 Feb 2011 19:39:25 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 13 Feb 2011 11:36:11 +0100
 
 apt (0.8.11.1) unstable; urgency=low
 
 
        MMap ed_cmds(MMap::ReadOnly);
        if (Patch.gzFd() != NULL) {
                unsigned long mapSize = Patch.Size();
-               DynamicMMap dyn(0, mapSize, 0);
-               gzread(Patch.gzFd(), dyn.Data(), mapSize);
-               ed_cmds = dyn;
+               DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0);
+               if (dyn->Data() == 0) {
+                       delete dyn;
+                       return MMAP_FAILED;
+               }
+               dyn->AddSize(mapSize);
+               gzread(Patch.gzFd(), dyn->Data(), mapSize);
+               ed_cmds = *dyn;
        } else
                ed_cmds = MMap(Patch, MMap::ReadOnly);