From e8a01b80db99dcffe27c1e93b061570d5207ce04 Mon Sep 17 00:00:00 2001 From: Arun Kumar Khandavalli Date: Mon, 12 Aug 2019 19:03:14 +0530 Subject: [PATCH] qcacld-3.0: Free the tdls memory in the error conditions As part of the tdls vdev creation, tdls osif memory is allocated and not freed in the error condition, which can result in the memory leak. Free the tdls osif memory in the error condition Change-Id: I084b14c4277be3e88142e3eaaabcf3293a15f220 CRs-Fixed: 2507609 --- components/tdls/core/src/wlan_tdls_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/tdls/core/src/wlan_tdls_main.c b/components/tdls/core/src/wlan_tdls_main.c index 52ef0d3a73f4..aac38365e11c 100644 --- a/components/tdls/core/src/wlan_tdls_main.c +++ b/components/tdls/core/src/wlan_tdls_main.c @@ -273,7 +273,8 @@ QDF_STATUS tdls_vdev_obj_create_notification(struct wlan_objmgr_vdev *vdev, tdls_vdev_obj = qdf_mem_malloc(sizeof(*tdls_vdev_obj)); if (!tdls_vdev_obj) { tdls_err("Failed to allocate memory for tdls vdev object"); - return QDF_STATUS_E_NOMEM; + status = QDF_STATUS_E_NOMEM; + goto err; } status = wlan_objmgr_vdev_component_obj_attach(vdev, @@ -304,7 +305,12 @@ QDF_STATUS tdls_vdev_obj_create_notification(struct wlan_objmgr_vdev *vdev, tdls_debug("tdls object attach to vdev successfully"); return status; err: - qdf_mem_free(tdls_vdev_obj); + if (tdls_soc_obj->tdls_osif_deinit_cb) + tdls_soc_obj->tdls_osif_deinit_cb(vdev); + if (tdls_vdev_obj) { + qdf_mem_free(tdls_vdev_obj); + tdls_vdev_obj = NULL; + } return status; }