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
This commit is contained in:
Aditya Kodukula 2021-04-26 12:18:36 -07:00 • committed by Gerrit - the friendly Code Review server
commit 4d31c10ff0

View file

@ -1651,6 +1651,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;
}