Kaynağa Gözat

qcacld-3.0: Avoid memory leak

Memory is created for the mlme legacy pointer during the create
of the mlme legacy priv object. This allocated memory doesn't get
free when an error condition which leads to device crash.

To avoid this problem memory should be freed before returning from
the error condition.

Change-Id: I8aaaf7bf17cf38f70135e5ff00db429c34aff2d8
CRs-Fixed: 2803896
Abdul Muqtadeer Ahmed 4 yıl önce
ebeveyn
işleme
5f15db8cf5

+ 2 - 0
components/mlme/core/src/wlan_mlme_vdev_mgr_interface.c

@@ -1158,6 +1158,7 @@ QDF_STATUS vdevmgr_mlme_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme)
 				     &vdev_mlme->mgmt.generic.subtype);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		mlme_err("Get vdev type failed; status:%d", status);
+		qdf_mem_free(vdev_mlme->ext_vdev_ptr);
 		return status;
 	}
 
@@ -1165,6 +1166,7 @@ QDF_STATUS vdevmgr_mlme_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme)
 	if (QDF_IS_STATUS_ERROR(status)) {
 		mlme_err("Failed to create vdev for vdev id %d",
 			 wlan_vdev_get_id(vdev_mlme->vdev));
+		qdf_mem_free(vdev_mlme->ext_vdev_ptr);
 		return status;
 	}