diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2022-11-06 12:33:42 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2022-11-06 12:33:42 +0000 |
commit | fb44138d9d2155c1349288b8ee4fafea67d8bfea (patch) | |
tree | d02c3b41f4a161b22c01f2f0599035a81d012356 /usr.sbin | |
parent | d9ffbcb8dad0c79cd1f07a6ffb6895c306876980 (diff) |
Don't leak args.fspec in create_filesystem().
ok kn@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/installboot/efi_installboot.c | 5 | ||||
-rw-r--r-- | usr.sbin/installboot/i386_installboot.c | 5 | ||||
-rw-r--r-- | usr.sbin/installboot/macppc_installboot.c | 5 | ||||
-rw-r--r-- | usr.sbin/installboot/octeon_installboot.c | 5 | ||||
-rw-r--r-- | usr.sbin/installboot/powerpc64_installboot.c | 5 |
5 files changed, 20 insertions, 5 deletions
diff --git a/usr.sbin/installboot/efi_installboot.c b/usr.sbin/installboot/efi_installboot.c index b0b26b8a4e5..77e7130e441 100644 --- a/usr.sbin/installboot/efi_installboot.c +++ b/usr.sbin/installboot/efi_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efi_installboot.c,v 1.6 2022/09/14 16:43:00 kn Exp $ */ +/* $OpenBSD: efi_installboot.c,v 1.7 2022/11/06 12:33:41 krw Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -166,6 +166,7 @@ create_filesystem(struct disklabel *dl, char part) rslt = snprintf(cmd, sizeof(cmd), newfsfmt, args.fspec); if (rslt >= sizeof(cmd)) { warnx("can't build newfs command"); + free(args.fspec); rslt = -1; return rslt; } @@ -177,10 +178,12 @@ create_filesystem(struct disklabel *dl, char part) rslt = system(cmd); if (rslt == -1) { warn("system('%s') failed", cmd); + free(args.fspec); return rslt; } } + free(args.fspec); return 0; } diff --git a/usr.sbin/installboot/i386_installboot.c b/usr.sbin/installboot/i386_installboot.c index b637c08e607..8ecb5ba151f 100644 --- a/usr.sbin/installboot/i386_installboot.c +++ b/usr.sbin/installboot/i386_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i386_installboot.c,v 1.43 2022/09/14 16:43:00 kn Exp $ */ +/* $OpenBSD: i386_installboot.c,v 1.44 2022/11/06 12:33:41 krw Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -267,6 +267,7 @@ create_filesystem(struct disklabel *dl, char part) rslt = snprintf(cmd, sizeof(cmd), newfsfmt, args.fspec); if (rslt >= sizeof(cmd)) { warnx("can't build newfs command"); + free(args.fspec); rslt = -1; return rslt; } @@ -278,10 +279,12 @@ create_filesystem(struct disklabel *dl, char part) rslt = system(cmd); if (rslt == -1) { warn("system('%s') failed", cmd); + free(args.fspec); return rslt; } } + free(args.fspec); return 0; } diff --git a/usr.sbin/installboot/macppc_installboot.c b/usr.sbin/installboot/macppc_installboot.c index a8144bcbbde..877ae125882 100644 --- a/usr.sbin/installboot/macppc_installboot.c +++ b/usr.sbin/installboot/macppc_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macppc_installboot.c,v 1.8 2022/09/14 16:43:00 kn Exp $ */ +/* $OpenBSD: macppc_installboot.c,v 1.9 2022/11/06 12:33:41 krw Exp $ */ /* * Copyright (c) 2011 Joel Sing <jsing@openbsd.org> @@ -138,6 +138,7 @@ create_filesystem(struct disklabel *dl, char part) rslt = snprintf(cmd, sizeof(cmd), newfsfmt, args.fspec); if (rslt >= sizeof(cmd)) { warnx("can't build newfs command"); + free(args.fspec); rslt = -1; return rslt; } @@ -149,10 +150,12 @@ create_filesystem(struct disklabel *dl, char part) rslt = system(cmd); if (rslt == -1) { warn("system('%s') failed", cmd); + free(args.fspec); return rslt; } } + free(args.fspec); return 0; } diff --git a/usr.sbin/installboot/octeon_installboot.c b/usr.sbin/installboot/octeon_installboot.c index 75d8bf969b6..2b1fa4ea843 100644 --- a/usr.sbin/installboot/octeon_installboot.c +++ b/usr.sbin/installboot/octeon_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: octeon_installboot.c,v 1.8 2022/09/27 11:42:16 kn Exp $ */ +/* $OpenBSD: octeon_installboot.c,v 1.9 2022/11/06 12:33:41 krw Exp $ */ /* * Copyright (c) 2011 Joel Sing <jsing@openbsd.org> @@ -138,6 +138,7 @@ create_filesystem(struct disklabel *dl, char part) rslt = snprintf(cmd, sizeof(cmd), newfsfmt, args.fspec); if (rslt >= sizeof(cmd)) { warnx("can't build newfs command"); + free(args.fspec); rslt = -1; return rslt; } @@ -149,10 +150,12 @@ create_filesystem(struct disklabel *dl, char part) rslt = system(cmd); if (rslt == -1) { warn("system('%s') failed", cmd); + free(args.fspec); return rslt; } } + free(args.fspec); return 0; } diff --git a/usr.sbin/installboot/powerpc64_installboot.c b/usr.sbin/installboot/powerpc64_installboot.c index a8d07f0fd40..c4765ab0c0d 100644 --- a/usr.sbin/installboot/powerpc64_installboot.c +++ b/usr.sbin/installboot/powerpc64_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: powerpc64_installboot.c,v 1.7 2022/09/27 11:31:46 kn Exp $ */ +/* $OpenBSD: powerpc64_installboot.c,v 1.8 2022/11/06 12:33:41 krw Exp $ */ /* * Copyright (c) 2011 Joel Sing <jsing@openbsd.org> @@ -145,6 +145,7 @@ create_filesystem(struct disklabel *dl, char part) rslt = snprintf(cmd, sizeof(cmd), newfsfmt, args.fspec); if (rslt >= sizeof(cmd)) { warnx("can't build newfs command"); + free(args.fspec); rslt = -1; return rslt; } @@ -156,10 +157,12 @@ create_filesystem(struct disklabel *dl, char part) rslt = system(cmd); if (rslt == -1) { warn("system('%s') failed", cmd); + free(args.fspec); return rslt; } } + free(args.fspec); return 0; } |