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

Colin Ian King colin.king at canonical.com
Wed Apr 11 09:44:03 UTC 2018


On 11/04/18 10:35, 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;
>  }
>  
> 
Thanks!

Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list