]> git.saurik.com Git - apt.git/blobdiff - methods/rred.cc
* apt-pkg/deb/dpkgpm.cc:
[apt.git] / methods / rred.cc
index 80cd14986ea4f4d34317a5732dd1f6992786f228..849973e1a6405a8fa06a1f37546789344b194a99 100644 (file)
@@ -255,9 +255,14 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,               /*{{{*/
        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->validData() == false) {
+                       delete dyn;
+                       return MMAP_FAILED;
+               }
+               dyn->AddSize(mapSize);
+               gzread(Patch.gzFd(), dyn->Data(), mapSize);
+               ed_cmds = *dyn;
        } else
                ed_cmds = MMap(Patch, MMap::ReadOnly);