]> git.saurik.com Git - apt.git/blobdiff - methods/rred.cc
merged from donkult
[apt.git] / methods / rred.cc
index e37a12ed952ee6dd1427d0d4c3c3e0ac70324b88..1e352d0e7850c235ef30532ec66aea20a7f7cac5 100644 (file)
@@ -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;
        }