summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/rred.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/methods/rred.cc b/methods/rred.cc
index 80cd14986..9ad0e4464 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -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->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);