From 4597eae120c664bcbb244f2d3500edae6ae9f9f8 Mon Sep 17 00:00:00 2001 From: Naveen Rawat Date: Fri, 27 Jan 2017 11:20:26 -0800 Subject: qcacld-3.0: Fix memory leak in wma_mgmt_rx_process Fix memory leak in wma_mgmt_rx_process, by moving memory alloc below all the sanity checks. Change-Id: I2e0663aefb9a7005910bcf0f3a0c1689084ef38e CRs-Fixed: 1116649 --- core/wma/src/wma_mgmt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 3a92298b1973..e6d40b2cc2c6 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -3192,12 +3192,6 @@ static int wma_mgmt_rx_process(void *handle, uint8_t *data, return -EINVAL; } - rx_pkt = qdf_mem_malloc(sizeof(*rx_pkt)); - if (!rx_pkt) { - WMA_LOGE("Failed to allocate rx packet"); - return -ENOMEM; - } - if (cds_is_load_or_unload_in_progress()) { WMA_LOGW(FL("Load/Unload in progress")); return -EINVAL; @@ -3208,6 +3202,12 @@ static int wma_mgmt_rx_process(void *handle, uint8_t *data, return -EINVAL; } + rx_pkt = qdf_mem_malloc(sizeof(*rx_pkt)); + if (!rx_pkt) { + WMA_LOGE("Failed to allocate rx packet"); + return -ENOMEM; + } + qdf_mem_zero(rx_pkt, sizeof(*rx_pkt)); /* -- cgit v1.2.3