From 9a4f494da2a879430246d0b76c25a96f87422494 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Wed, 29 Jun 2022 16:19:01 +0800 Subject: [PATCH] wireless/bcm43xxx: fix memory leak if tx fail Signed-off-by: chao.an --- .../wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c index 6097546a57..2c2f5fc0c2 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c @@ -387,20 +387,17 @@ int bcmf_sdpcm_sendframe(FAR struct bcmf_dev_s *priv) ret = bcmf_transfer_bytes(sbus, true, 2, 0, sframe->header.base, sframe->header.len); - if (ret == OK) + is_txframe = sframe->tx; + + /* Free frame buffer */ + + bcmf_sdio_free_frame(priv, sframe); + + if (ret == OK && is_txframe) { - is_txframe = sframe->tx; + /* Notify upper layer at least one TX buffer is available */ - /* Free frame buffer */ - - bcmf_sdio_free_frame(priv, sframe); - - if (is_txframe) - { - /* Notify upper layer at least one TX buffer is available */ - - bcmf_netdev_notify_tx(priv); - } + bcmf_netdev_notify_tx(priv); } return ret;