mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
qcacld-3.0: Fix possible memory leak of tx_time_per_power_level
It is possible tx_time_per_power_level is not freed in last event, and it is reused in __wma_unified_radio_tx_power_level_stats_event_handler, the buffer size may be different for each event by manually test. Fix is to check if memory is freed before malloc, if not null, free it before malloc. Change-Id: I51064734cf97b9ff0ecbbaf27f38d5a223c91d3b CRs-Fixed: 3057436
This commit is contained in:
parent
1ebed1b2f0
commit
19edb11baa
1 changed files with 15 additions and 10 deletions
|
|
@ -1961,18 +1961,23 @@ static int wma_unified_radio_tx_power_level_stats_event_handler(void *handle,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!rs_results->tx_time_per_power_level) {
|
||||
rs_results->tx_time_per_power_level = qdf_mem_malloc(
|
||||
sizeof(uint32_t) *
|
||||
rs_results->total_num_tx_power_levels);
|
||||
if (!rs_results->tx_time_per_power_level) {
|
||||
/* In error case, atleast send the radio stats without
|
||||
* tx_power_level stats */
|
||||
rs_results->total_num_tx_power_levels = 0;
|
||||
link_stats_results->nr_received++;
|
||||
goto post_stats;
|
||||
}
|
||||
if (rs_results->tx_time_per_power_level) {
|
||||
qdf_mem_free(rs_results->tx_time_per_power_level);
|
||||
rs_results->tx_time_per_power_level = NULL;
|
||||
}
|
||||
|
||||
rs_results->tx_time_per_power_level =
|
||||
qdf_mem_malloc(sizeof(uint32_t) *
|
||||
rs_results->total_num_tx_power_levels);
|
||||
if (!rs_results->tx_time_per_power_level) {
|
||||
/* In error case, atleast send the radio stats without
|
||||
* tx_power_level stats
|
||||
*/
|
||||
rs_results->total_num_tx_power_levels = 0;
|
||||
link_stats_results->nr_received++;
|
||||
goto post_stats;
|
||||
}
|
||||
|
||||
qdf_mem_copy(&rs_results->tx_time_per_power_level[
|
||||
fixed_param->power_level_offset],
|
||||
tx_power_level_values,
|
||||
|
|
|
|||
Loading…
Reference in a new issue