From ca8f461682ea5d145ad937d4f968bab0f8a2cc8f Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Wed, 13 Jun 2018 14:21:53 +0530 Subject: [PATCH] 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 --- core/sme/src/common/sme_api.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 0d7eef6ebdac..bce3e21f8d10 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -8244,7 +8244,6 @@ QDF_STATUS sme_get_link_speed(tHalHandle hHal, tSirLinkSpeedInfo *lsReq, QDF_STATUS status = QDF_STATUS_SUCCESS; tpAniSirGlobal pMac; - tSirLinkSpeedInfo *req; void *wma_handle; if (!hHal || !pCallbackfn || !lsReq) { @@ -8261,25 +8260,16 @@ QDF_STATUS sme_get_link_speed(tHalHandle hHal, tSirLinkSpeedInfo *lsReq, } 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; }