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

Alex Hung alex.hung at canonical.com
Tue May 7 05:38:36 UTC 2013


On 05/07/2013 06:30 AM, 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);
>
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list