diff mbox

DSPBRIDGE: Fix to avoid possible memory leaks in bridge driver.

Message ID B852767254C5C94EBB1040EE0EFA06008C4CFD72@dlee01.ent.ti.com (mailing list archive)
State Accepted, archived
Delegated to:
Headers show

Commit Message

Ramos Falcon, Ernesto Jan. 28, 2010, 6:27 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/dsp/bridge/pmgr/dbll.c b/drivers/dsp/bridge/pmgr/dbll.c
index 5422d21..fab749e 100644
--- a/drivers/dsp/bridge/pmgr/dbll.c
+++ b/drivers/dsp/bridge/pmgr/dbll.c
@@ -1347,13 +1347,14 @@  static int rmmAlloc(struct Dynamic_Loader_Allocate *this,
 				 req, segId);
 		}
 	}
+func_cont:
 	MEM_Free(szSectName);
 	szSectName = NULL;
 	MEM_Free(szLastToken);
 	szLastToken = NULL;
 	MEM_Free(szSecLastToken);
 	szSecLastToken = NULL;
-func_cont:
+
 	if (memType == DBLL_CODE)
 		allocSize = info->size + GEM_L1P_PREFETCH_SIZE;
 	else
diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index c69e3af..373bd26 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -616,7 +616,6 @@  DSP_STATUS DRV_Create(OUT struct DRV_OBJECT **phDRVObject)
 				status = DSP_EFAIL;
 				GT_0trace(curTrace, GT_7CLASS,
 					 "Failed to Create DRV_EXT list ");
-				MEM_FreeObject(pDRVObject);
 			} else {
 				INIT_LIST_HEAD(&pDRVObject->devNodeString->
 					head);
@@ -626,7 +625,6 @@  DSP_STATUS DRV_Create(OUT struct DRV_OBJECT **phDRVObject)
 			status = DSP_EMEMORY;
 			GT_0trace(curTrace, GT_7CLASS,
 				 "Failed to Create Dev List ");
-			MEM_FreeObject(pDRVObject);
 		}
 	} else {
 		status = DSP_EMEMORY;
@@ -642,6 +640,8 @@  DSP_STATUS DRV_Create(OUT struct DRV_OBJECT **phDRVObject)
 			 pDRVObject);
 		*phDRVObject = pDRVObject;
 	} else {
+		MEM_Free(pDRVObject->devList);
+		MEM_Free(pDRVObject->devNodeString);
 		/* Free the DRV Object */
 		MEM_Free(pDRVObject);
 		GT_0trace(curTrace, GT_7CLASS,
diff --git a/drivers/dsp/bridge/wmd/msg_sm.c b/drivers/dsp/bridge/wmd/msg_sm.c
index 50201e5..974d266 100644
--- a/drivers/dsp/bridge/wmd/msg_sm.c
+++ b/drivers/dsp/bridge/wmd/msg_sm.c
@@ -129,8 +129,8 @@  DSP_STATUS WMD_MSG_CreateQueue(struct MSG_MGR *hMsgMgr,
 	DSP_STATUS status = DSP_SOK;
 
 	if (!MEM_IsValidHandle(hMsgMgr, MSGMGR_SIGNATURE) ||
-	   phMsgQueue == NULL) {
-		status = DSP_EMEMORY;
+	   phMsgQueue == NULL || !hMsgMgr->msgFreeList) {
+		status = DSP_EHANDLE;
 		goto func_end;
 	}
 
@@ -177,10 +177,6 @@  DSP_STATUS WMD_MSG_CreateQueue(struct MSG_MGR *hMsgMgr,
 		status = SYNC_OpenEvent(&pMsgQ->hSyncDoneAck, NULL);
 
 	if (DSP_SUCCEEDED(status)) {
-		if (!hMsgMgr->msgFreeList) {
-			status = DSP_EHANDLE;
-			goto func_end;
-		}
 		/* Enter critical section */
 		(void)SYNC_EnterCS(hMsgMgr->hSyncCS);
 		/* Initialize message frames and put in appropriate queues */