Bladeren bron

qcacmn: Avoid mem leak when create DFS object

When x_psoc_create_handle return failed,  need free all resources
before return, x_psoc_destroy_handler has no chance to be called
any more.

Change-Id: I4b9999dbc2597c4ea860f08a6f3334f7f5728146
CRs-Fixed: 2353795
Jianmin Zhu 6 jaren geleden
bovenliggende
commit
5d9c2898db
1 gewijzigde bestanden met toevoegingen van 8 en 1 verwijderingen
  1. 8 1
      umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c

+ 8 - 1
umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c

@@ -366,13 +366,20 @@ QDF_STATUS wlan_dfs_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	global_dfs_to_mlme.pdev_component_obj_attach(pdev,
+	status = global_dfs_to_mlme.pdev_component_obj_attach(pdev,
 		WLAN_UMAC_COMP_DFS, (void *)dfs, QDF_STATUS_SUCCESS);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "obj attach failed");
+		dfs_destroy_object(dfs);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	dfs->dfs_pdev_obj = pdev;
 
 	if (!dfs_tx_ops->dfs_is_tgt_offload) {
 		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
 			"dfs_is_tgt_offload is null");
+		dfs_destroy_object(dfs);
 		return QDF_STATUS_E_FAILURE;
 	}