summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-06-24 16:31:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-06-24 16:31:03 +0000
commit0d7046573b3bbef90fb11951a776a2da7f844a59 (patch)
tree01b249861894bb993f3b8e5dfcbacb6c51a66f68 /sys/arch/sparc64
parent029d87acbf134a46b1a861bfa1be1bfdcea81ae5 (diff)
free() correct object; andrushock@korovino.net
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/stand/installboot/installboot.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/arch/sparc64/stand/installboot/installboot.c b/sys/arch/sparc64/stand/installboot/installboot.c
index bdc3aad2a7b..bd589a68a2b 100644
--- a/sys/arch/sparc64/stand/installboot/installboot.c
+++ b/sys/arch/sparc64/stand/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.5 2004/01/11 23:59:22 pvalchev Exp $ */
+/* $OpenBSD: installboot.c,v 1.6 2004/06/24 16:31:02 deraadt Exp $ */
/* $NetBSD: installboot.c,v 1.8 2001/02/19 22:48:59 cgd Exp $ */
/*-
@@ -282,8 +282,10 @@ loadprotoblocks(fname, size)
bp = ap + (hflag ? 32 : 0);
marks[MARK_START] = bp - st;
- if ((fd = loadfile(fname, marks, LOAD_TEXT|LOAD_DATA)) == -1)
+ if ((fd = loadfile(fname, marks, LOAD_TEXT|LOAD_DATA)) == -1) {
+ free((void *)ap);
return NULL;
+ }
(void)close(fd);
block_table = (daddr_t *) (bp + nl[X_BLOCKTABLE].n_value - st);
@@ -292,19 +294,19 @@ loadprotoblocks(fname, size)
if ((int)(u_long)block_table & 3) {
warn("%s: invalid address: block_table = %p",
fname, block_table);
- free((void *)bp);
+ free((void *)ap);
return NULL;
}
if ((int)(u_long)block_count_p & 3) {
warn("%s: invalid address: block_count_p = %p",
fname, block_count_p);
- free((void *)bp);
+ free((void *)ap);
return NULL;
}
if ((int)(u_long)block_size_p & 3) {
warn("%s: invalid address: block_size_p = %p",
fname, block_size_p);
- free((void *)bp);
+ free((void *)ap);
return NULL;
}
max_block_count = *block_count_p;