summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-02-20 22:06:47 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-02-20 22:06:47 +0000
commite7cf2cbef8ea82ba845cd64f7ebcfebd17dd9c4d (patch)
treea4785cb885a0f48994799c488e6d04f61d1326e0 /sys
parent715cca9cfb87d96fbd297eb384697b886c7a4919 (diff)
Fix a memory leak in acx_load_radio_firmware() -- free the ucode after use.
OK mglocker@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/acx.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c
index 8639272dd7b..20ab345d78b 100644
--- a/sys/dev/ic/acx.c
+++ b/sys/dev/ic/acx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acx.c,v 1.60 2006/12/31 14:27:17 claudio Exp $ */
+/* $OpenBSD: acx.c,v 1.61 2007/02/20 22:06:46 claudio Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -1518,16 +1518,23 @@ acx_load_radio_firmware(struct acx_softc *sc, const char *name)
* Get the position, where base firmware is loaded, so that
* radio firmware can be loaded after it.
*/
- if (acx_get_mmap_conf(sc, &mem_map) != 0)
+ if (acx_get_mmap_conf(sc, &mem_map) != 0) {
+ free(ucode, M_DEVBUF);
return (ENXIO);
+ }
radio_fw_ofs = letoh32(mem_map.code_end);
/* Put ECPU into sleeping state, before loading radio firmware */
- if (acx_exec_command(sc, ACXCMD_SLEEP, NULL, 0, NULL, 0) != 0)
+ if (acx_exec_command(sc, ACXCMD_SLEEP, NULL, 0, NULL, 0) != 0) {
+ free(ucode, M_DEVBUF);
return (ENXIO);
+ }
/* Load radio firmware */
error = acx_load_firmware(sc, radio_fw_ofs, ucode, size);
+
+ free(ucode, M_DEVBUF);
+
if (error) {
printf("%s: can't load radio firmware\n", ifp->if_xname);
return (ENXIO);