From a27593c6be614eeb7a2b16ccecd64176ca6830a1 Mon Sep 17 00:00:00 2001 From: Aditya Kodukula Date: Wed, 7 Apr 2021 15:53:21 -0700 Subject: [PATCH] qcacld-3.0: Fix memory leak in set_wifi_test_config vendor command In the current implementation of the function __wlan_hdd_cfg80211_set_wifi_test_config, if the status returned by get_cfg API is not Success, it returns froms the function without freeing the allocated memory. This causes a potential memory leak. To avoid this, free the allocated memory properly. Change-Id: I5f9ac5f2edc49ebad662f18dbe09893f8bee6459 CRs-Fixed: 2918850 --- core/hdd/src/wlan_hdd_cfg80211.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 17de87ae01a2..c61303fdcf6e 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -9849,7 +9849,8 @@ __wlan_hdd_cfg80211_set_wifi_test_config(struct wiphy *wiphy, &wmm_mode); if (!QDF_IS_STATUS_SUCCESS(status)) { hdd_err("Get wmm_mode failed"); - return QDF_STATUS_E_FAILURE; + ret_val = -EINVAL; + goto send_err; } sme_config->csr_config.WMMSupportMode = hdd_to_csr_wmm_mode(wmm_mode); @@ -10298,11 +10299,13 @@ __wlan_hdd_cfg80211_set_wifi_test_config(struct wiphy *wiphy, &rf_test_mode); if (!QDF_IS_STATUS_SUCCESS(status)) { hdd_err("Get rf test mode failed"); - return QDF_STATUS_E_FAILURE; + ret_val = -EINVAL; + goto send_err; } if (rf_test_mode) { hdd_err("rf test mode is enabled, ignore setting"); - return 0; + ret_val = 0; + goto send_err; } cfg_val = nla_get_u8(tb[cmd_id]); hdd_debug("safe mode setting %d", cfg_val);