From 2546093dca04eca518241f3fb8493d60b3efbf79 Mon Sep 17 00:00:00 2001 From: Naveen Rawat Date: Fri, 5 Feb 2016 16:56:08 -0800 Subject: [PATCH] qcacld-3.0: Fix memory leak for lim preauth timers at driver unload This is qcacld-2.0 to qcacld-3.0 propagation Fix memory leak at driver unload by freeing memory for lim preauth timers. Change-Id: I7be177e6c475a8f8fdc4cc7d2744e34a4bf5dbf5 CRs-Fixed: 960617 --- core/mac/src/pe/lim/lim_api.c | 3 +++ core/mac/src/pe/lim/lim_timer_utils.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index aaf5995062cd..d974686547a4 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -644,6 +644,7 @@ tSirRetStatus lim_initialize(tpAniSirGlobal pMac) void lim_cleanup(tpAniSirGlobal pMac) { + uint8_t i; /* * Before destroying the list making sure all the nodes have been * deleted Which should be the normal case, but a memory leak has been @@ -670,6 +671,8 @@ void lim_cleanup(tpAniSirGlobal pMac) /* free up preAuth table */ if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL) { + for (i = 0; i < pMac->lim.gLimPreAuthTimerTable.numEntry; i++) + qdf_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable[i]); qdf_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable); pMac->lim.gLimPreAuthTimerTable.pTable = NULL; pMac->lim.gLimPreAuthTimerTable.numEntry = 0; diff --git a/core/mac/src/pe/lim/lim_timer_utils.c b/core/mac/src/pe/lim/lim_timer_utils.c index 6507497b6688..14222a61f14e 100644 --- a/core/mac/src/pe/lim/lim_timer_utils.c +++ b/core/mac/src/pe/lim/lim_timer_utils.c @@ -437,7 +437,7 @@ err_timer: tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer); if (NULL != pMac->lim.gLimPreAuthTimerTable.pTable) { - for (i = 0; i < cfgValue; i++) + for (i = 0; i < pMac->lim.gLimPreAuthTimerTable.numEntry; i++) qdf_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable[i]); qdf_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable); pMac->lim.gLimPreAuthTimerTable.pTable = NULL;