wlan: Fix issues in limSetLinkStateForPostAssocCallback()
Static source code analysis identified several issues in
limSetLinkStateForPostAssocCallback() including memory leaks, a double
free, and access to an uninitialized variable, so resolve these
issues.
Change-Id: I13cf8f079996ef1677336b3db435bf5e3585aa55
CRs-fixed: 470188
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
index deae19b..f0ffd39 100644
--- a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
@@ -2714,8 +2714,6 @@
if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
{
limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
- if( NULL != pAddBssParams )
- palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
goto end;
}
@@ -2784,8 +2782,8 @@
if( eHAL_STATUS_SUCCESS !=
palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
{
- limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
- return;
+ limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA" ));
+ goto end;
}
palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
@@ -2889,6 +2887,8 @@
/* Update PE sessio Id*/
if (psessionEntry != NULL)
mlmReassocCnf.sessionId = psessionEntry->peSessionId;
+ else
+ mlmReassocCnf.sessionId = 0;
limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
}