[PATCH] acpi: battery: free gpe resources on error

Colin Ian King colin.king at canonical.com
Mon May 20 10:17:01 UTC 2013


On 06/05/13 23:30, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> Coverity CID #997269, Resource leak.
> 
> Need to free gpe resources before we return.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/battery/battery.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c
> index 2fbc228..f83f086 100644
> --- a/src/acpi/battery/battery.c
> +++ b/src/acpi/battery/battery.c
> @@ -80,6 +80,7 @@ static int wait_for_acpi_event(fwts_framework *fw, char *name)
>  
>  	if ((fd = fwts_acpi_event_open()) < 0) {
>  		fwts_log_error(fw, "Cannot connect to acpid.");
> +		fwts_gpe_free(gpes_start, gpe_count);
>  		return FWTS_ERROR;
>  	}
>  
> @@ -102,6 +103,8 @@ static int wait_for_acpi_event(fwts_framework *fw, char *name)
>  
>  	if ((gpe_count = fwts_gpe_read(&gpes_end)) == FWTS_ERROR) {
>  		fwts_log_error(fw, "Cannot read GPEs.");
> +		fwts_gpe_free(gpes_start, gpe_count);
> +		return FWTS_ERROR;
>  	}
>  
>  	fwts_gpe_test(fw, gpes_start, gpes_end, gpe_count);
> 

we require one more ack on this, and for some reason I don't see it on
patchworks so it's not showing up.

Colin



More information about the fwts-devel mailing list