summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2009-09-03 10:52:13 -0700
committerDmitry Shmidt <dimitrysh@google.com>2009-09-03 11:03:50 -0700
commitbad6fbebd4588d035d2cde5da6c021200481559a (patch)
tree0e040731bb19e87ea8cb7a1ed745634355111e3f
parent02031bf384692af64df1fdc67d00d373c2a6c85d (diff)
downloadti-bad6fbebd4588d035d2cde5da6c021200481559a.tar.gz
Revert "Revert "Fix memory leaks.""
This reverts commit 4adc645208e279467a70fd4fbc5e08a40d97c0ca.
-rw-r--r--wilink_6_1/platforms/os/linux/src/WlanDrvIf.c6
-rw-r--r--wilink_6_1/stad/src/Connection_Managment/externalSec.c38
-rw-r--r--wilink_6_1/stad/src/Connection_Managment/externalSec.h1
-rw-r--r--wilink_6_1/stad/src/Connection_Managment/mainSecSm.c14
-rw-r--r--wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c7
5 files changed, 59 insertions, 7 deletions
diff --git a/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c b/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c
index 9a13acd..c719d49 100644
--- a/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c
+++ b/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c
@@ -381,7 +381,7 @@ int wlanDrvIf_LoadFiles (TWlanDrvIfObj *drv, TLoaderFilesData *pInitFiles)
drv->tCommon.tIniFile.uSize = pInitFiles->uIniFileLength;
drv->tCommon.tIniFile.pImage = kmalloc (pInitFiles->uIniFileLength, GFP_KERNEL);
#ifdef TI_MEM_ALLOC_TRACE
- osPrintf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, pInitFiles->uIniFileLength, GFP_KERNEL, pInitFiles->uIniFileLength);
+ os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, pInitFiles->uIniFileLength, GFP_KERNEL, pInitFiles->uIniFileLength);
#endif
if (!drv->tCommon.tIniFile.pImage)
{
@@ -398,7 +398,7 @@ int wlanDrvIf_LoadFiles (TWlanDrvIfObj *drv, TLoaderFilesData *pInitFiles)
drv->tCommon.tNvsImage.uSize = pInitFiles->uNvsFileLength;
drv->tCommon.tNvsImage.pImage = kmalloc (drv->tCommon.tNvsImage.uSize, GFP_KERNEL);
#ifdef TI_MEM_ALLOC_TRACE
- osPrintf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n",
+ os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n",
__FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, GFP_KERNEL, drv->tCommon.tNvsImage.uSize);
#endif
if (!drv->tCommon.tNvsImage.pImage)
@@ -417,7 +417,7 @@ int wlanDrvIf_LoadFiles (TWlanDrvIfObj *drv, TLoaderFilesData *pInitFiles)
}
drv->tCommon.tFwImage.pImage = os_memoryAlloc (drv, drv->tCommon.tFwImage.uSize);
#ifdef TI_MEM_ALLOC_TRACE
- osPrintf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n",
+ os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n",
__FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, GFP_KERNEL, drv->tCommon.tFwImage.uSize);
#endif
if (!drv->tCommon.tFwImage.pImage)
diff --git a/wilink_6_1/stad/src/Connection_Managment/externalSec.c b/wilink_6_1/stad/src/Connection_Managment/externalSec.c
index 0b470e8..5e4c924 100644
--- a/wilink_6_1/stad/src/Connection_Managment/externalSec.c
+++ b/wilink_6_1/stad/src/Connection_Managment/externalSec.c
@@ -115,8 +115,6 @@ TI_STATUS externalSec_config(mainSec_t *pMainSec)
return status;
}
-
-
/**
*
* Function - externalSec_create.
@@ -162,6 +160,41 @@ struct externalSec_t* externalSec_create(TI_HANDLE hOs)
/**
*
+* Function - externalSec_unload.
+*
+* \b Description:
+*
+* Called by mainSecSM (mainSec_unload).
+*
+* \b ARGS:
+*
+*
+* \b RETURNS:
+*
+* TI_STATUS - 0 on success, any other value on failure.
+*
+*/
+TI_STATUS externalSec_unload(struct externalSec_t *pExternalSec)
+{
+ TI_STATUS status;
+
+ if (!pExternalSec)
+ {
+ return TI_NOK;
+ }
+ status = fsm_Unload(pExternalSec->hOs, pExternalSec->pExternalSecSm);
+ if (status != TI_OK)
+ {
+ /* report failure but don't stop... */
+ TRACE0(pExternalSec->hReport, REPORT_SEVERITY_ERROR, "EXTERNAL SECURITY: Error releasing FSM memory \n");
+ }
+
+ os_memoryFree(pExternalSec->hOs, pExternalSec, sizeof(struct externalSec_t));
+ return TI_OK;
+}
+
+/**
+*
* Function - externalSecSM_start.
*
* \b Description:
@@ -321,4 +354,3 @@ TI_STATUS externalSecSM_Unexpected(struct externalSec_t *pExternalSec)
TRACE0(pExternalSec->hReport, REPORT_SEVERITY_ERROR, "EXTERNAL_SEC_SM: ERROR UnExpected Event\n");
return(TI_OK);
}
-
diff --git a/wilink_6_1/stad/src/Connection_Managment/externalSec.h b/wilink_6_1/stad/src/Connection_Managment/externalSec.h
index d7253ba..fa65158 100644
--- a/wilink_6_1/stad/src/Connection_Managment/externalSec.h
+++ b/wilink_6_1/stad/src/Connection_Managment/externalSec.h
@@ -98,6 +98,7 @@ struct externalSec_t
TI_STATUS externalSec_config(mainSec_t *pMainSec);
struct externalSec_t* externalSec_create(TI_HANDLE hOs);
+TI_STATUS externalSec_unload(struct externalSec_t *pExternalSec);
TI_STATUS externalSec_event(struct externalSec_t *pExternalSec, TI_UINT8 event, void *pData);
TI_STATUS externalSec_rsnComplete(struct externalSec_t *pExternalSec);
#endif /* _EXTERNAL_SEC_H*/
diff --git a/wilink_6_1/stad/src/Connection_Managment/mainSecSm.c b/wilink_6_1/stad/src/Connection_Managment/mainSecSm.c
index 867887c..74cae08 100644
--- a/wilink_6_1/stad/src/Connection_Managment/mainSecSm.c
+++ b/wilink_6_1/stad/src/Connection_Managment/mainSecSm.c
@@ -140,6 +140,13 @@ mainSec_t* mainSec_create(TI_HANDLE hOs)
/* created only for external security mode */
pHandle->pExternalSec = externalSec_create(hOs);
+ if (pHandle->pExternalSec == NULL)
+ {
+ mainKeys_unload(pHandle->pMainKeys);
+ fsm_Unload(hOs, pHandle->pMainSecSm);
+ os_memoryFree(hOs, pHandle, sizeof(mainSec_t));
+ return NULL;
+ }
return pHandle;
}
@@ -266,6 +273,13 @@ TI_STATUS mainSec_unload(mainSec_t *pMainSec)
TRACE0(pMainSec->hReport, REPORT_SEVERITY_ERROR, "MAIN_SEC_SM: Error releasing FSM memory \n");
}
+ status = externalSec_unload(pMainSec->pExternalSec);
+ if (status != TI_OK)
+ {
+ /* report failure but don't stop... */
+ TRACE0(pMainSec->hReport, REPORT_SEVERITY_ERROR, "MAIN_SEC_SM: Error releasing ExternalSec memory \n");
+ }
+
os_memoryFree(pMainSec->hOs, pMainSec, sizeof(mainSec_t));
return TI_OK;
diff --git a/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c b/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c
index e53a561..82a4c15 100644
--- a/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c
+++ b/wilink_6_1/stad/src/Ctrl_Interface/DrvMain.c
@@ -658,6 +658,11 @@ TI_STATUS drvMain_Destroy (TI_HANDLE hDrvMain)
scr_release (pDrvMain->tStadHandles.hSCR);
}
+ if (pDrvMain->tStadHandles.hTxnQ != NULL)
+ {
+ txnQ_Destroy (pDrvMain->tStadHandles.hTxnQ);
+ }
+
if (pDrvMain->tStadHandles.hEvHandler != NULL)
{
EvHandlerUnload (pDrvMain->tStadHandles.hEvHandler);
@@ -753,7 +758,7 @@ TI_STATUS drvMain_Destroy (TI_HANDLE hDrvMain)
context_Destroy (pDrvMain->tStadHandles.hContext);
}
- if (pDrvMain->tStadHandles.hStaCap != NULL)
+ if (pDrvMain->tStadHandles.hStaCap != NULL)
{
StaCap_Destroy (pDrvMain->tStadHandles.hStaCap);
}