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
This commit is contained in:
Aditya Kodukula 2021-04-07 15:53:21 -07:00 • committed by snandini
commit a27593c6be

View file

@ -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);