Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jan 2012 05:48:52 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229688 - in stable/9/usr.sbin/bsdinstall: distextract distfetch partedit
Message-ID:  <201201060548.q065mq3L074171@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Fri Jan  6 05:48:52 2012
New Revision: 229688
URL: http://svn.freebsd.org/changeset/base/229688

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

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

Modified: stable/9/usr.sbin/bsdinstall/distextract/distextract.c
==============================================================================
--- stable/9/usr.sbin/bsdinstall/distextract/distextract.c	Fri Jan  6 05:45:23 2012	(r229687)
+++ stable/9/usr.sbin/bsdinstall/distextract/distextract.c	Fri Jan  6 05:48:52 2012	(r229688)
@@ -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: stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c
==============================================================================
--- stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c	Fri Jan  6 05:45:23 2012	(r229687)
+++ stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c	Fri Jan  6 05:48:52 2012	(r229688)
@@ -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: stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c
==============================================================================
--- stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c	Fri Jan  6 05:45:23 2012	(r229687)
+++ stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c	Fri Jan  6 05:48:52 2012	(r229688)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201060548.q065mq3L074171>