wireless/bcm43xxx: fix memory leak if tx fail

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-06-29 16:19:01 +08:00 committed by Xiang Xiao
parent f424bb32aa
commit 9a4f494da2
1 changed files with 9 additions and 12 deletions

View File

@ -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;