summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorkevlo <kevlo@FreeBSD.org>2011-11-28 05:34:16 +0000
committerkevlo <kevlo@FreeBSD.org>2011-11-28 05:34:16 +0000
commit6473db59df76b9aa589e199e2847c57a18da2ab2 (patch)
treec7afc4b69d9e9ba70b33ded78f534b09f5a465c9 /usr.sbin
parenteb7c1e5049be3381264012c77f7f4d2c998dd48f (diff)
downloadFreeBSD-src-6473db59df76b9aa589e199e2847c57a18da2ab2.zip
FreeBSD-src-6473db59df76b9aa589e199e2847c57a18da2ab2.tar.gz
Plug memory leaks and fix open(2) error check.
Reviewed by: nwhitehorn MFC after: 3 days
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bsdinstall/distextract/distextract.c1
-rw-r--r--usr.sbin/bsdinstall/distfetch/distfetch.c1
-rw-r--r--usr.sbin/bsdinstall/partedit/gpart_ops.c2
3 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/bsdinstall/distextract/distextract.c b/usr.sbin/bsdinstall/distextract/distextract.c
index 397932f..a76ebfe 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 0ced75c..bb72417 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 52f145e..6bbce17 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;
OpenPOWER on IntegriCloud