qcacld-3.0: Fix memory leak in sme_get_link_speed
In the API sme_get_link_speed, the driver allocates memory
to the req, needed to get link speed from firmware
but is not freed, thus a memory leak may happen.
Fix is to remove the req from this API as the driver already
has this info from caller API.
Change-Id: I091bd81b162cd7e6f548068866ecdd441302553a
CRs-Fixed: 2257373
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 0d7eef6..bce3e21 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -8244,7 +8244,6 @@
QDF_STATUS status = QDF_STATUS_SUCCESS;
tpAniSirGlobal pMac;
- tSirLinkSpeedInfo *req;
void *wma_handle;
if (!hHal || !pCallbackfn || !lsReq) {
@@ -8261,25 +8260,16 @@
}
pMac = PMAC_STRUCT(hHal);
- req = qdf_mem_malloc(sizeof(*req));
- if (!req) {
- sme_err("Failed to allocate memory");
- return QDF_STATUS_E_NOMEM;
- }
- *req = *lsReq;
-
status = sme_acquire_global_lock(&pMac->sme);
if (QDF_STATUS_SUCCESS != status) {
sme_err("Failed to acquire global lock");
- qdf_mem_free(req);
return QDF_STATUS_E_FAILURE;
}
pMac->sme.pLinkSpeedCbContext = plsContext;
pMac->sme.pLinkSpeedIndCb = pCallbackfn;
- status = wma_get_link_speed(wma_handle, req);
+ status = wma_get_link_speed(wma_handle, lsReq);
sme_release_global_lock(&pMac->sme);
-
return status;
}