qcacld-3.0: Free link_layer_stats results properly

As per the logic implemented in the FW, it will send a dummy event for
link layer stats in case the buffer allocation fails. In this case,
there can occur a scenario in host wherein we are not properly freeing
the previously allocated memory.

In the event handler wma_unified_link_radio_stats_event_handler, if the
event is dummy, we are updating the value of the num_radios inside
wma_handle->link_layer_results. This num_radios is later used to free
any allocated memory. On setting it to zero, we are preventing that
memfree to occur; leading to a memleak.

To fix this, in case there is a dummy event, first free any possible
previous results before setting the num_radios to be zero.

Change-Id: Ibe4ddf1a137a33130100483cefb004b7dae4ce02
CRs-Fixed: 2610754
This commit is contained in:
Sourav Mohapatra
2020-01-28 16:29:11 +05:30
committed by nshrivas
szülő 823052541b
commit 2cbc99c302
2 fájl változott, egészen pontosan 44 új sor hozzáadva és 9 régi sor törölve

Fájl megtekintése

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -186,6 +186,17 @@ bool wma_is_rx_ldpc_supported_for_channel(uint32_t ch_freq);
#ifdef WLAN_FEATURE_LINK_LAYER_STATS
int wma_unified_radio_tx_mem_free(void *handle);
/*
* wma_unified_link_stats_results_mem_free() - Free the memory for
* link_stats_results->results allocated when event comes.
* @link_stats_results: pointer to the memory that is to be freed
*
* Return: None
*/
void
wma_unified_link_stats_results_mem_free(tSirLLStatsResults *link_stats_results);
#else /* WLAN_FEATURE_LINK_LAYER_STATS */
static inline int wma_unified_radio_tx_mem_free(void *handle)
{