Module Name:    src
Committed By:   msaitoh
Date:           Sun Aug 18 13:29:15 UTC 2019

Modified Files:
        src/usr.sbin/sysinst [netbsd-9]: install.c util.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #83):
        usr.sbin/sysinst/util.c: revision 1.31
        usr.sbin/sysinst/install.c: revision 1.10
        usr.sbin/sysinst/install.c: revision 1.11
Fix some memory leaks in error paths
Oops, avoid double free.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.2.1 src/usr.sbin/sysinst/install.c
cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/install.c
diff -u src/usr.sbin/sysinst/install.c:1.9 src/usr.sbin/sysinst/install.c:1.9.2.1
--- src/usr.sbin/sysinst/install.c:1.9	Tue Jul 23 18:13:40 2019
+++ src/usr.sbin/sysinst/install.c	Sun Aug 18 13:29:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: install.c,v 1.9 2019/07/23 18:13:40 martin Exp $	*/
+/*	$NetBSD: install.c,v 1.9.2.1 2019/08/18 13:29:15 msaitoh Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -165,7 +165,7 @@ do_install(void)
 		if (!md_get_info(&install) ||
 		    !md_make_bsd_partitions(&install)) {
 			hit_enter_to_continue(MSG_abort_inst, NULL);
-			return;
+			goto error;
 		}
 
 		/* Last chance ... do you really want to do this? */
@@ -173,7 +173,7 @@ do_install(void)
 		refresh();
 		msg_fmt_display(MSG_lastchance, "%s", pm->diskdev);
 		if (!ask_noyes(NULL))
-			return;
+			goto error;
 
 		/*
 		 * Check if we have a secondary partitioning and
@@ -194,19 +194,19 @@ do_install(void)
 		    make_filesystems(&install) ||
 		    make_fstab(&install) != 0 ||
 		    md_post_newfs(&install) != 0)
-		return;
+		goto error;
 	}
 
 	/* Unpack the distribution. */
 	process_menu(MENU_distset, &retcode);
 	if (retcode == 0)
-		return;
+		goto error;
 	if (get_and_unpack_sets(0, MSG_disksetupdone,
 	    MSG_extractcomplete, MSG_abortinst) != 0)
-		return;
+		goto error;
 
 	if (md_post_extract(&install) != 0)
-		return;
+		goto error;
 
 	do_configmenu(&install);
 
@@ -214,7 +214,8 @@ do_install(void)
 
 	md_cleanup_install(&install);
 
-	free(install.infos);
-
 	hit_enter_to_continue(MSG_instcomplete, NULL);
+
+error:
+	free(install.infos);
 }

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.29.2.1 src/usr.sbin/sysinst/util.c:1.29.2.2
--- src/usr.sbin/sysinst/util.c:1.29.2.1	Sun Aug 18 13:25:21 2019
+++ src/usr.sbin/sysinst/util.c	Sun Aug 18 13:29:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.29.2.1 2019/08/18 13:25:21 msaitoh Exp $	*/
+/*	$NetBSD: util.c,v 1.29.2.2 2019/08/18 13:29:15 msaitoh Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -933,6 +933,7 @@ extract_file(distinfo *dist, int update)
 			    1, &dist->name);
 			hit_enter_to_continue(err, NULL);
 			free(err);
+			free(owd);
 			return SET_RETRY;
 		}
 #ifdef SUPPORT_8_3_SOURCE_FILESYSTEM

Reply via email to