Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e5778ac authored by Srinivas Girigowda's avatar Srinivas Girigowda Committed by snandini
Browse files

qcacld-3.0: Fix memory leak in TWT add dialog event handler error cases

Fix memory leak issues in TWT add dialog event handler error cases
before returning from the function.

CRs-Fixed: 2890261
Change-Id: Ia367084a3919be9275e1b5e327f79a1d43df3803
parent ddf92ee3
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ int wma_twt_add_dialog_complete_event_handler(void *handle,
	tp_wma_handle wma_handle = handle;
	wmi_unified_t wmi_handle;
	struct mac_context *mac = cds_get_context(QDF_MODULE_ID_PE);
	int status = -EINVAL;
	QDF_STATUS status;

	if (!wma_handle) {
		wma_err("Invalid wma handle for TWT add dialog complete");
@@ -213,7 +213,7 @@ int wma_twt_add_dialog_complete_event_handler(void *handle,
	status = wmi_extract_twt_add_dialog_comp_event(wmi_handle, event,
						       &add_dialog_event->params);
	if (QDF_IS_STATUS_ERROR(status))
		return qdf_status_to_os_return(status);
		goto exit;

	if (add_dialog_event->params.num_additional_twt_params) {
		status = wmi_extract_twt_add_dialog_comp_additional_params(wmi_handle,
@@ -221,7 +221,7 @@ int wma_twt_add_dialog_complete_event_handler(void *handle,
									   len, 0,
									   &add_dialog_event->additional_params);
		if (QDF_IS_STATUS_ERROR(status))
			return qdf_status_to_os_return(status);
			goto exit;
	}

	wma_debug("TWT: Extract TWT add dialog event id:%d",
@@ -234,9 +234,13 @@ int wma_twt_add_dialog_complete_event_handler(void *handle,
					QDF_MODULE_ID_SME,
					QDF_MODULE_ID_SME, &sme_msg);
	if (QDF_IS_STATUS_ERROR(status))
		return -EINVAL;
		goto exit;

	return status;
exit:
	if (QDF_IS_STATUS_ERROR(status))
		qdf_mem_free(add_dialog_event);

	return qdf_status_to_os_return(status);
}

QDF_STATUS