From 4d31c10ff0f86adbd858b9c22549bbebcc682334 Mon Sep 17 00:00:00 2001 From: Aditya Kodukula Date: Mon, 26 Apr 2021 12:18:36 -0700 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_station_info.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/hdd/src/wlan_hdd_station_info.c b/core/hdd/src/wlan_hdd_station_info.c index 96b0509fecc7..6c03febbe333 100644 --- a/core/hdd/src/wlan_hdd_station_info.c +++ b/core/hdd/src/wlan_hdd_station_info.c @@ -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; }