diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2017-01-30 16:25:51 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2017-01-30 16:25:51 +0000 |
commit | 3f7b09a21b49d15c1fe22d45757f03660a408377 (patch) | |
tree | 89dc7c8dbefe9ae727099e02937b5a5dc4c92b90 /sys | |
parent | 0a68cebc25622b8dc12879e1cf5ecbc17bbcba8e (diff) |
Fix size passed to free(9)
ok tb@ stsp@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/rtwn.c | 9 |
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); } |