NACK: [PATCH] acpi: s3: free quirks and command resources

Colin Ian King colin.king at canonical.com
Tue May 7 09:48:31 UTC 2013


On 07/05/13 00:00, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> Coverity CID #997264, Resource leak.
> 
> Need to free quirks and command before we return.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/s3/s3.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index ae89423..7528ec2 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -73,8 +73,8 @@ static int s3_do_suspend_resume(fwts_framework *fw,
>  	int differences;
>  	time_t t_start;
>  	time_t t_end;
> -	char *command;
> -	char *quirks;
> +	char *command = NULL;
> +	char *quirks = NULL;
>  	char buffer[80];
>  
>  	fwts_klog_clear();
> @@ -183,6 +183,11 @@ static int s3_do_suspend_resume(fwts_framework *fw,
>  		fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT);
>  	}
>  
> +	if (command)
> +		free(command);
> +	if (quirks)
> +		free(quirks);
> +
>  	return FWTS_OK;
>  }
>  
> 
Bad fix, please ignore




More information about the fwts-devel mailing list