summaryrefslogtreecommitdiff
path: root/methods/rred.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-01-20 01:02:36 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-01-20 01:02:36 +0100
commitaaab10075397cb4f2ec262c5d478f7ea8acd2d23 (patch)
treec02f41b1102b79d43e7d93a4ebf83f14d86bf8b1 /methods/rred.cc
parent38ff3de6a82c4dc03adcef98919ff6bd6dc1603a (diff)
fix a few esoteric cppcheck errors/warnings/infos
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;
}