From: jsg Date: Sun, 26 Mar 2023 09:39:46 +0000 (+0000) Subject: fix memory leaks in error paths X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=104b58f553b8902fdb17844995ecb1bed9b65505;p=openbsd fix memory leaks in error paths ok miod@ --- diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index a5e6d0788da..ffa6fd7b889 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.107 2023/03/15 22:47:35 stsp Exp $ */ +/* $OpenBSD: bwfm.c,v 1.108 2023/03/26 09:39:46 jsg Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt @@ -1649,6 +1649,7 @@ bwfm_proto_bcdc_query_dcmd(struct bwfm_softc *sc, int ifidx, if (bwfm_proto_bcdc_txctl(sc, reqid, (char *)dcmd, &size)) { DPRINTF(("%s: tx failed\n", DEVNAME(sc))); + free(dcmd, M_TEMP, size); return ret; } @@ -1689,6 +1690,7 @@ bwfm_proto_bcdc_set_dcmd(struct bwfm_softc *sc, int ifidx, if (bwfm_proto_bcdc_txctl(sc, reqid, (char *)dcmd, &size)) { DPRINTF(("%s: txctl failed\n", DEVNAME(sc))); + free(dcmd, M_TEMP, size); return ret; } @@ -1713,6 +1715,7 @@ bwfm_proto_bcdc_txctl(struct bwfm_softc *sc, int reqid, char *buf, size_t *len) if (sc->sc_bus_ops->bs_txctl(sc, ctl)) { DPRINTF(("%s: tx failed\n", DEVNAME(sc))); + free(ctl, M_TEMP, sizeof(*ctl)); return 1; }