From 8130c13068d47fe4b42d2527d340b3238e90047b Mon Sep 17 00:00:00 2001 From: kevlo Date: Fri, 6 Jan 2012 05:48:52 +0000 Subject: [PATCH] MFC r228048: Plug memory leaks and fix open(2) error check. Reviewed by: nwhitehorn git-svn-id: svn://svn.freebsd.org/base/stable/9@229688 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/bsdinstall/distextract/distextract.c | 1 + usr.sbin/bsdinstall/distfetch/distfetch.c | 1 + usr.sbin/bsdinstall/partedit/gpart_ops.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bsdinstall/distextract/distextract.c b/usr.sbin/bsdinstall/distextract/distextract.c index 397932f24..a76ebfe64 100644 --- a/usr.sbin/bsdinstall/distextract/distextract.c +++ b/usr.sbin/bsdinstall/distextract/distextract.c @@ -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); } diff --git a/usr.sbin/bsdinstall/distfetch/distfetch.c b/usr.sbin/bsdinstall/distfetch/distfetch.c index 0ced75cd7..bb72417bf 100644 --- a/usr.sbin/bsdinstall/distfetch/distfetch.c +++ b/usr.sbin/bsdinstall/distfetch/distfetch.c @@ -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); } diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index 52f145eec..6bbce1720 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -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; -- 2.45.0