summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Khandavalli <akhandav@codeaurora.org>2016-08-17 17:43:06 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-27 16:16:07 -0700
commitf6246630ce518b91ef23ccbc8a8374f16ad49070 (patch)
tree3f0ef3ca43bdf38b97eb08e83c30532a0cbcb404
parent8e0216378a761d96e15199f16b57fee9326e63cd (diff)
qcacld-3.0: Allocate memory for cds config only once
During the driver load cds_cfg memory is allocated during the hdd_Wlan_startup and cds_open. Since the memory allocated by the cds_open overwrites the pointer of memory allocated by hdd_wlan_statup during memory free only memory allocated by cds_open is freed resulting in memory leakage. To migitate this issue, allocate the memory for the cds config only once. Change-Id: I01bf0e8110a2519a2e11da398be3c98f9ca4db8f CRs-Fixed: 1055648
-rw-r--r--core/cds/src/cds_api.c3
-rw-r--r--core/hdd/src/wlan_hdd_main.c10
2 files changed, 7 insertions, 6 deletions
diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c
index 998853eec11b..acfae2518ce4 100644
--- a/core/cds/src/cds_api.c
+++ b/core/cds/src/cds_api.c
@@ -268,7 +268,6 @@ QDF_STATUS cds_open(void)
goto err_sched_close;
}
- hdd_update_config(pHddCtx);
cds_cfg = cds_get_ini_config();
if (!cds_cfg) {
cds_err("Cds config is NULL");
@@ -2191,7 +2190,7 @@ void cds_deinit_ini_config(void)
return;
}
- if (!cds_ctx->cds_cfg)
+ if (cds_ctx->cds_cfg)
qdf_mem_free(cds_ctx->cds_cfg);
cds_ctx->cds_cfg = NULL;
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 2a0510c4d1b6..c9251c4a7c0b 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -1731,6 +1731,12 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
goto hif_close;
}
+ ret = hdd_update_config(hdd_ctx);
+ if (ret) {
+ hdd_err("Failed to update configuration :%d", ret);
+ goto ol_cds_free;
+ }
+
status = cds_open();
if (!QDF_IS_STATUS_SUCCESS(status)) {
hdd_err("Failed to Open CDS: %d", status);
@@ -7384,10 +7390,6 @@ int hdd_wlan_startup(struct device *dev)
hdd_wlan_green_ap_init(hdd_ctx);
- ret = hdd_update_config(hdd_ctx);
- if (ret)
- goto err_exit_nl_srv;
-
ret = hdd_wlan_start_modules(hdd_ctx, adapter, false);
if (ret) {
hdd_alert("Failed to start modules: %d", ret);