From 7ae9b7bed4423417068d5d529310cdaee7e57a5b Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Tue, 19 Dec 2017 15:11:54 +0530 Subject: [PATCH] qcacld-3.0: Fix mem leak in hdd_wlan_start_modules In function hdd_wlan_start_modules, when hdd_configure_cds return error, driver does not free memory buffer hdd_ctx->target_hw_name in hdd_update_hw_sw_info, which is allocated when the driver is in the open state. Fix is to free the memory for hdd_ctx->target_hw_name buffer and set to NULL. Change-Id: Ib8bee8d4df51404e848cfd4da628ebf3f7ff718d CRs-Fixed: 2159490 --- core/hdd/src/wlan_hdd_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 4fff2e447861..e76a14458180 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2867,7 +2867,10 @@ power_down: release_lock: hdd_ctx->start_modules_in_progress = false; mutex_unlock(&hdd_ctx->iface_change_lock); - + if (hdd_ctx->target_hw_name) { + qdf_mem_free(hdd_ctx->target_hw_name); + hdd_ctx->target_hw_name = NULL; + } /* many adapter resources are not freed by design in SSR case */ if (!reinit) hdd_check_for_leaks();