Browse Source

qcacld-3.0: Fix memory leak in wlan_hdd_get_peer_stats

In the current implementation of the function wlan_hdd_get_peer_stats,
if the status returned by the call cdp_host_get_peer_stats is not
successful, then it returns from the function without freeing the
memory allocated to peer_stats. This causes a memory leak. To avoid
this issue, free the memory properly before returning from the function.

Change-Id: Ia002be4cf6c0b93eba2dc65d96d63e6c0eafad90
CRs-Fixed: 2932487
Aditya Kodukula 4 years ago
parent
commit
0195232c6a
1 changed files with 1 additions and 0 deletions
  1. 1 0
      core/hdd/src/wlan_hdd_station_info.c

+ 1 - 0
core/hdd/src/wlan_hdd_station_info.c

@@ -1654,6 +1654,7 @@ static int hdd_get_peer_stats(struct hdd_adapter *adapter,
 					 stainfo->sta_mac.bytes, peer_stats);
 	if (status != QDF_STATUS_SUCCESS) {
 		hdd_err("cdp_host_get_peer_stats failed");
+		qdf_mem_free(peer_stats);
 		return -EINVAL;
 	}