[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] allocating error handling in modstub.c
- From: HARA Hiroshi <hhara miraclelinux com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: [PATCH] allocating error handling in modstub.c
- Date: Fri, 31 Aug 2007 12:29:46 +0900
Hi,
I added checking code after strdup and realloc
in modstub.c
thank you.
--- loader2/modstubs.c 14 Aug 2007 19:23:41 -0000 1.15
+++ loader2/modstubs.c 31 Aug 2007 03:19:05 -0000
@@ -95,6 +95,12 @@
return usage();
}
+ if (!options) {
+ logMessage(ERROR, "cannot allocate memory for options: %s",
+ strerror(errno));
+ return 1;
+ }
+
while (argc > 2) {
if (!strcmp(argv[1], "-p")) {
ballPath = malloc(strlen(argv[2]) + 30);
@@ -143,6 +149,11 @@
for (i = 2; i < argc; i++) {
options = realloc(options,
strlen(options) + 1 + strlen(argv[i]) + 1);
+ if (!options) {
+ logMessage(ERROR, "cannot allocate memory for options: %s",
+ strerror(errno));
+ return 1;
+ }
strcat(options, argv[i]);
strcat(options, " ");
}
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]