summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-01-30 16:25:51 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-01-30 16:25:51 +0000
commit3f7b09a21b49d15c1fe22d45757f03660a408377 (patch)
tree89dc7c8dbefe9ae727099e02937b5a5dc4c92b90 /sys
parent0a68cebc25622b8dc12879e1cf5ecbc17bbcba8e (diff)
Fix size passed to free(9)
ok tb@ stsp@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/rtwn.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/ic/rtwn.c b/sys/dev/ic/rtwn.c
index dd64449710c..9f6b62f6d22 100644
--- a/sys/dev/ic/rtwn.c
+++ b/sys/dev/ic/rtwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtwn.c,v 1.12 2017/01/26 10:57:37 stsp Exp $ */
+/* $OpenBSD: rtwn.c,v 1.13 2017/01/30 16:25:50 jca Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -1439,14 +1439,15 @@ rtwn_load_firmware(struct rtwn_softc *sc)
{
const struct r92c_fw_hdr *hdr;
u_char *fw, *ptr;
- size_t len;
+ size_t len0, len;
uint32_t reg;
int mlen, ntries, page, error;
/* Read firmware image from the filesystem. */
- error = sc->sc_ops.load_firmware(sc->sc_ops.cookie, &fw, &len);
+ error = sc->sc_ops.load_firmware(sc->sc_ops.cookie, &fw, &len0);
if (error)
return (error);
+ len = len0;
if (len < sizeof(*hdr)) {
printf("%s: firmware too short\n", sc->sc_pdev->dv_xname);
error = EINVAL;
@@ -1537,7 +1538,7 @@ rtwn_load_firmware(struct rtwn_softc *sc)
goto fail;
}
fail:
- free(fw, M_DEVBUF, len);
+ free(fw, M_DEVBUF, len0);
return (error);
}