ieee802154 MAC: Free allocated TX descriptor if an error occurs after the descriptor has been allocated.

This commit is contained in:
Gregory Nutt 2017-06-20 15:00:23 -06:00
parent d9f549121c
commit cd8ac3f070
3 changed files with 6 additions and 2 deletions

View File

@ -550,7 +550,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
/* And submit the frame to the MAC */
ninfo("Submitting framelist\n");
ninfo("Submitting frame\n");
ret = sixlowpan_frame_submit(ieee, &meta, iob);
if (ret < 0)
{

View File

@ -130,6 +130,7 @@ static void mac802154_resetqueues(FAR struct ieee802154_privmac_s *priv)
{
sq_addlast((FAR sq_entry_t *)&priv->txdesc_pool[i], &priv->txdesc_queue);
}
sem_init(&priv->txdesc_sem, 0, CONFIG_MAC802154_NTXDESC);
/* Initialize the notifcation allocation pool */

View File

@ -340,7 +340,10 @@ int mac802154_req_data(MACHANDLE mac,
return OK;
errout_with_txdesc:
/* REVISIT: Free TX descriptor, but preserve the IOB. */
/* Free TX the descriptor, but preserve the IOB. */
txdesc->frame = NULL;
mac802154_txdesc_free(priv, txdesc);
errout_with_sem:
mac802154_givesem(&priv->exclsem);