Browse Source

qcacld-3.0: Fix memleak in psoc create sequence

After psoc create is successful, destroy and release
psoc if cds open fails.

Change-Id: Ia0bf593511d0b90a4a21510ec8e80d85f126443c
CRs-Fixed: 1116856
Selvaraj, Sridhar 8 years ago
parent
commit
a7dc2381e7
2 changed files with 5 additions and 3 deletions
  1. 1 2
      core/cds/src/cds_api.c
  2. 4 1
      core/hdd/src/wlan_hdd_main.c

+ 1 - 2
core/cds/src/cds_api.c

@@ -484,8 +484,7 @@ QDF_STATUS cds_open(struct wlan_objmgr_psoc *psoc)
 		  "%s: CDS successfully Opened", __func__);
 	cds_register_all_modules();
 
-	dispatcher_psoc_open(psoc);
-	return QDF_STATUS_SUCCESS;
+	return dispatcher_psoc_open(psoc);
 
 err_sme_close:
 	sme_close(gp_cds_context->pMACContext);

+ 4 - 1
core/hdd/src/wlan_hdd_main.c

@@ -1797,7 +1797,7 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
 		status = cds_open(hdd_ctx->hdd_psoc);
 		if (!QDF_IS_STATUS_SUCCESS(status)) {
 			hdd_err("Failed to Open CDS: %d", status);
-			goto ol_cds_free;
+			goto destroy_psoc_object;
 		}
 
 		hdd_ctx->driver_status = DRIVER_MODULES_OPENED;
@@ -1853,6 +1853,9 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
 close:
 	cds_close(hdd_ctx->hdd_psoc, p_cds_context);
 
+destroy_psoc_object:
+	hdd_release_and_destroy_psoc(hdd_ctx);
+
 ol_cds_free:
 	ol_cds_free();