ACK: [PATCH] cpufreq: Dont free a NULL pointer

Alex Hung alex.hung at canonical.com
Wed Apr 11 18:28:16 UTC 2018


On 2018-04-11 02:35 AM, Shilpasri G Bhat wrote:
> Reported-by: Pridhiviraj Paidipeddi <ppaidipe at linux.vnet.ibm.com>
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
> ---
>   src/cpu/cpufreq/cpufreq.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 6cd7014..d1e50cd 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -794,10 +794,9 @@ static int parse_cpu_info(fwts_framework *fw,
>   		cpu->n_freqs = i;
>   		qsort(cpu->freqs, cpu->n_freqs, sizeof(cpu->freqs[0]),
>   			cpu_freq_compare);
> +		free(str);
>   	}
>   
> -	free(str);
> -
>   	/* parse boost frequencies */
>   	cpu_mkpath(path, sizeof(path), cpu, "scaling_boost_frequencies");
>   	str = fwts_get(path);
> @@ -815,9 +814,9 @@ static int parse_cpu_info(fwts_framework *fw,
>   		cpu->n_freqs = i;
>   		qsort(cpu->freqs, cpu->n_freqs, sizeof(cpu->freqs[0]),
>   		      cpu_freq_compare);
> +		free(str);
>   	}
>   
> -	free(str);
>   	return FWTS_OK;
>   }
>   
> 


Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list