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

View File

@ -387,21 +387,18 @@ 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 (is_txframe)
if (ret == OK && is_txframe)
{
/* Notify upper layer at least one TX buffer is available */
bcmf_netdev_notify_tx(priv);
}
}
return ret;
}