svn commit: r228048 - in head/usr.sbin/bsdinstall: distextract distfetch partedit

Kevin Lo kevlo at FreeBSD.org
Mon Nov 28 05:34:16 UTC 2011


Author: kevlo
Date: Mon Nov 28 05:34:16 2011
New Revision: 228048
URL: http://svn.freebsd.org/changeset/base/228048

Log:
  Plug memory leaks and fix open(2) error check.
  
  Reviewed by:	nwhitehorn
  MFC after:	3 days

Modified:
  head/usr.sbin/bsdinstall/distextract/distextract.c
  head/usr.sbin/bsdinstall/distfetch/distfetch.c
  head/usr.sbin/bsdinstall/partedit/gpart_ops.c

Modified: head/usr.sbin/bsdinstall/distextract/distextract.c
==============================================================================
--- head/usr.sbin/bsdinstall/distextract/distextract.c	Sun Nov 27 23:31:22 2011	(r228047)
+++ head/usr.sbin/bsdinstall/distextract/distextract.c	Mon Nov 28 05:34:16 2011	(r228048)
@@ -49,6 +49,7 @@ main(void)
 	dists = calloc(ndists, sizeof(const char *));
 	if (dists == NULL) {
 		fprintf(stderr, "Out of memory!\n");
+		free(diststring);
 		return (1);
 	}
 

Modified: head/usr.sbin/bsdinstall/distfetch/distfetch.c
==============================================================================
--- head/usr.sbin/bsdinstall/distfetch/distfetch.c	Sun Nov 27 23:31:22 2011	(r228047)
+++ head/usr.sbin/bsdinstall/distfetch/distfetch.c	Mon Nov 28 05:34:16 2011	(r228048)
@@ -48,6 +48,7 @@ main(void)
 	urls = calloc(ndists, sizeof(const char *));
 	if (urls == NULL) {
 		fprintf(stderr, "Out of memory!\n");
+		free(diststring);
 		return (1);
 	}
 

Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c
==============================================================================
--- head/usr.sbin/bsdinstall/partedit/gpart_ops.c	Sun Nov 27 23:31:22 2011	(r228047)
+++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c	Mon Nov 28 05:34:16 2011	(r228048)
@@ -301,7 +301,7 @@ gpart_bootcode(struct ggeom *gp)
 		return;
 
 	bootfd = open(bootcode, O_RDONLY);
-	if (bootfd <= 0) {
+	if (bootfd < 0) {
 		dialog_msgbox("Bootcode Error", strerror(errno), 0, 0,
 		    TRUE);
 		return;


More information about the svn-src-head mailing list