diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-10-19 12:35:18 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-10-19 12:35:18 +0000 |
commit | a2034251c391d82dc781d0d781690ba26c060bbe (patch) | |
tree | e063163e9c30d7df2e7dd3e6dc6ca5bd6125f8bc /sys/dev | |
parent | a54a4e796c1947803f8922456c3f484e9e5e180f (diff) |
Don't forget to free the firmware in the error path, and make sure to
pass the proper size.
Caught by Jared McNeill.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/if_bwfm_usb.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/usb/if_bwfm_usb.c b/sys/dev/usb/if_bwfm_usb.c index 33f02b4331b..db37acfb980 100644 --- a/sys/dev/usb/if_bwfm_usb.c +++ b/sys/dev/usb/if_bwfm_usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bwfm_usb.c,v 1.2 2017/10/15 14:55:13 patrick Exp $ */ +/* $OpenBSD: if_bwfm_usb.c,v 1.3 2017/10/19 12:35:17 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -357,10 +357,11 @@ bwfm_usb_attachhook(struct device *self) if (bwfm_usb_load_microcode(sc, ucode, size) != 0) { printf("%s: could not load microcode\n", DEVNAME(sc)); + free(ucode, M_DEVBUF, size); return; } - free(ucode, M_DEVBUF, 0); + free(ucode, M_DEVBUF, size); for (i = 0; i < 10; i++) { delay(100 * 1000); |