* Exit if malloc fails - previously the error was ignored
* Free allocated memory before returning
Signed-off-by: Simon Horman <[EMAIL PROTECTED]>
Index: kexec-tools-unstable/kexec/kexec.c
===================================================================
--- kexec-tools-unstable.orig/kexec/kexec.c 2007-02-01 11:50:28.000000000
+0900
+++ kexec-tools-unstable/kexec/kexec.c 2007-02-01 11:50:32.000000000 +0900
@@ -197,6 +197,10 @@
/* Compute the free memory ranges */
max_mem_ranges = memory_ranges + info->nr_segments;
mem_range = malloc(max_mem_ranges *sizeof(struct memory_range));
+ if (!mem_range) {
+ perror("locate_hole: malloc");
+ exit(-1);
+ }
mem_ranges = 0;
/* Perform a merge on the 2 sorted lists of memory ranges */
@@ -265,6 +269,7 @@
}
}
}
+ free(mem_range);
if (hole_base == ULONG_MAX) {
fprintf(stderr, "Could not find a free area of memory of "
"%lx bytes...\n", hole_size);
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot