Browse Source

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
Arun Kumar Khandavalli 5 years ago
parent
commit
e8a01b80db
1 changed files with 8 additions and 2 deletions
  1. 8 2
      components/tdls/core/src/wlan_tdls_main.c

+ 8 - 2
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;
 }