Module Name:    src
Committed By:   tsutsui
Date:           Wed Apr 22 12:35:46 UTC 2009

Modified Files:
        src/distrib/utils/sysinst/arch/alpha: md.c

Log Message:
Make sure to free(3) memory allocated by asprintf(3) in bootxx_name().


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/distrib/utils/sysinst/arch/alpha/md.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/sysinst/arch/alpha/md.c
diff -u src/distrib/utils/sysinst/arch/alpha/md.c:1.46 src/distrib/utils/sysinst/arch/alpha/md.c:1.47
--- src/distrib/utils/sysinst/arch/alpha/md.c:1.46	Tue Apr  7 10:45:04 2009
+++ src/distrib/utils/sysinst/arch/alpha/md.c	Wed Apr 22 12:35:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.46 2009/04/07 10:45:04 tsutsui Exp $	*/
+/*	$NetBSD: md.c,v 1.47 2009/04/22 12:35:46 tsutsui Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -127,14 +127,21 @@
 md_post_newfs(void)
 {
 	char *bootxx;
+	int error;
 
-	printf (msg_string(MSG_dobootblks), diskdev);
+	printf(msg_string(MSG_dobootblks), diskdev);
 	cp_to_target("/usr/mdec/boot", "/boot");
 	bootxx = bootxx_name();
-	if (bootxx == NULL || run_program(RUN_DISPLAY | RUN_NO_CLEAR,
-	    "/usr/sbin/installboot /dev/r%sc %s", diskdev, bootxx))
+	if (bootxx != NULL) {
+		error = run_program(RUN_DISPLAY | RUN_NO_CLEAR,
+		    "/usr/sbin/installboot /dev/r%sc %s", diskdev, bootxx);
+		free(bootxx);
+	} else
+		error = -1;
+
+	if (error != 0)
 		process_menu(MENU_ok,
-			 deconst("Warning: disk is probably not bootable"));
+		    deconst("Warning: disk is probably not bootable"));
 
 	return 0;
 }

Reply via email to