summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2012-07-03 13:09:25 +0000
committerjsg <jsg@openbsd.org>2012-07-03 13:09:25 +0000
commit48e4789bfea471f3207878257d0089f7e33fc1e8 (patch)
treec57f36acc89c985e000039df88d6d56ffb766382
parentBCM5754 should stay, noticed by brad (diff)
downloadwireguard-openbsd-48e4789bfea471f3207878257d0089f7e33fc1e8.tar.xz
wireguard-openbsd-48e4789bfea471f3207878257d0089f7e33fc1e8.zip
avoid what would be a leak if reused elsewhere but isn't in this
case as the memory is freed on exit. ok krw@ kettenis@
-rw-r--r--usr.sbin/pcidump/pcidump.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/pcidump/pcidump.c b/usr.sbin/pcidump/pcidump.c
index e186d4256ff..0dfd31e722e 100644
--- a/usr.sbin/pcidump/pcidump.c
+++ b/usr.sbin/pcidump/pcidump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcidump.c,v 1.31 2012/05/16 13:01:50 jsg Exp $ */
+/* $OpenBSD: pcidump.c,v 1.32 2012/07/03 13:09:25 jsg Exp $ */
/*
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
@@ -761,8 +761,12 @@ dump_vga_bios(void)
if (pread(fd, bios, VGA_BIOS_LEN, VGA_BIOS_ADDR) == -1)
err(1, "%s", _PATH_MEM);
- if (write(romfd, bios, VGA_BIOS_LEN) == -1)
+ if (write(romfd, bios, VGA_BIOS_LEN) == -1) {
+ free(bios);
return (errno);
+ }
+
+ free(bios);
return (0);
#else