summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2010-03-15 14:14:11 -0700
committerDmitry Shmidt <dimitrysh@google.com>2010-03-15 14:14:11 -0700
commitebbf3c4d16536e401fdaf0389d592590c4bae83d (patch)
tree02337eb9c660ae123b1d0aaed32d4da6d04e0b56
parent1bf55343ee55f1d7c0d7b379c0d9adf4727872b6 (diff)
downloadti-ebbf3c4d16536e401fdaf0389d592590c4bae83d.tar.gz
tnetw1271: Check for NULL pointer in txCtrlBlk_Free()
Change-Id: I9bbfcc38abefd311da1b807b0954d763b233ad1c Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--wilink_6_1/TWD/Data_Service/txCtrlBlk.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/wilink_6_1/TWD/Data_Service/txCtrlBlk.c b/wilink_6_1/TWD/Data_Service/txCtrlBlk.c
index 1462e1b..a776bdb 100644
--- a/wilink_6_1/TWD/Data_Service/txCtrlBlk.c
+++ b/wilink_6_1/TWD/Data_Service/txCtrlBlk.c
@@ -212,24 +212,28 @@ void txCtrlBlk_Free (TI_HANDLE hTxCtrlBlk, TTxCtrlBlk *pCurrentEntry)
TTxCtrlBlkObj *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk;
TTxCtrlBlk *pFirstFreeEntry = &(pTxCtrlBlk->aTxCtrlBlkTbl[0]);
+ if (!pTxCtrlBlk) {
+ return;
+ }
+
#ifdef TI_DBG
/* If the pointed entry is already free, print error and exit (not expected to happen). */
if (pCurrentEntry->pNextFreeEntry != 0)
{
-TRACE2(pTxCtrlBlk->hReport, REPORT_SEVERITY_ERROR, "txCtrlBlk_free(): Entry %d alredy free, UsedEntries=%d\n", pCurrentEntry->tTxDescriptor.descID, pTxCtrlBlk->uNumUsedEntries);
+ TRACE2(pTxCtrlBlk->hReport, REPORT_SEVERITY_ERROR, "txCtrlBlk_free(): Entry %d alredy free, UsedEntries=%d\n", pCurrentEntry->tTxDescriptor.descID, pTxCtrlBlk->uNumUsedEntries);
return;
}
pTxCtrlBlk->uNumUsedEntries--;
#endif
- /* Protect block freeing from preemption (may be called from external context) */
- context_EnterCriticalSection (pTxCtrlBlk->hContext);
+ /* Protect block freeing from preemption (may be called from external context) */
+ context_EnterCriticalSection (pTxCtrlBlk->hContext);
/* Link the freed entry between entry 0 and the next free entry. */
pCurrentEntry->pNextFreeEntry = pFirstFreeEntry->pNextFreeEntry;
pFirstFreeEntry->pNextFreeEntry = pCurrentEntry;
- context_LeaveCriticalSection (pTxCtrlBlk->hContext);
+ context_LeaveCriticalSection (pTxCtrlBlk->hContext);
}