summaryrefslogtreecommitdiff
path: root/methods/rred.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-01-24 20:18:39 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2012-01-24 20:18:39 +0100
commit5b172c0263c12f1163cfa17170a9b0da917e782c (patch)
treea8a978b0ca1891c492c554c8c1d9cbf5c030b529 /methods/rred.cc
parent76dbf3cee365788eb7291c96f06b73a3769946d6 (diff)
parent3102af74e7ffaab3f47741c05451ce7f0e3b38fe (diff)
merged from experimental
Diffstat (limited to 'methods/rred.cc')
-rw-r--r--methods/rred.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/methods/rred.cc b/methods/rred.cc
index e37a12ed9..1e352d0e7 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -333,7 +333,12 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/
}
if(command_count == command_alloc) {
command_alloc = (command_alloc + 64) * 3 / 2;
- commands = (EdCommand*) realloc(commands, command_alloc * sizeof(EdCommand));
+ EdCommand* newCommands = (EdCommand*) realloc(commands, command_alloc * sizeof(EdCommand));
+ if (newCommands == NULL) {
+ free(commands);
+ return MMAP_FAILED;
+ }
+ commands = newCommands;
}
commands[command_count++] = cmd;
}