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

Commit 9e154956 authored by Abhinav Kumar's avatar Abhinav Kumar Committed by nshrivas
Browse files

qcacld-3.0: Possible mem leak in sme_set_miracast

In sme_set_miracast If mac_ptr is NULL and qdf_mem_malloc(sizeof(*val))
returns success, driver returns without qdf_mem_free for val.
This results in memory leak in sme_set_miracast.

Allocate mem for val only if mac_ptr is valid.

Change-Id: I98a6f0acc9452f7f04aa4949fc8efe21b260fac7
CRs-Fixed: 2465861
parent e744a980
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -10038,10 +10038,14 @@ QDF_STATUS sme_set_miracast(tHalHandle hal, uint8_t filter_type)
	uint32_t *val;
	tpAniSirGlobal mac_ptr = PMAC_STRUCT(hal);

	if (!mac_ptr) {
		sme_err("Invalid pointer");
		return QDF_STATUS_E_NOMEM;
	}

	val = qdf_mem_malloc(sizeof(*val));
	if (NULL == val || NULL == mac_ptr) {
		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
				"%s: Invalid pointer", __func__);
	if (!val) {
		sme_err("Mem allocation failed");
		return QDF_STATUS_E_NOMEM;
	}