NACK: [PATCH] acpi: method: fix two memory leaks on error return paths

Colin Ian King colin.king at canonical.com
Fri Feb 19 13:27:13 UTC 2021


On 19/02/2021 13:00, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> Static analysis with Coverity detected two memory leaks on
> error return paths. Add in the missing free's before returning.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/method/method.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
> index 598ffe76..52681981 100644
> --- a/src/acpi/method/method.c
> +++ b/src/acpi/method/method.c
> @@ -2169,8 +2169,10 @@ static void method_test_PSS_return(
>  		return;
>  	}
>  
> -	if (fwts_method_package_elements_all_type(fw, name, obj, ACPI_TYPE_PACKAGE) != FWTS_OK)
> +	if (fwts_method_package_elements_all_type(fw, name, obj, ACPI_TYPE_PACKAGE) != FWTS_OK) {
> +		free(element_ok);
>  		return;
> +	}
>  
>  	for (i = 0; i < obj->Package.Count; i++) {
>  		ACPI_OBJECT *pstate;
> @@ -2363,8 +2365,10 @@ static void method_test_TSS_return(
>  		return;
>  	}
>  
> -	if (fwts_method_package_elements_all_type(fw, name, obj, ACPI_TYPE_PACKAGE) != FWTS_OK)
> +	if (fwts_method_package_elements_all_type(fw, name, obj, ACPI_TYPE_PACKAGE) != FWTS_OK) {
> +		free(tss_elements_ok)

missing semicolon, NACK, sending V2.

>  		return;
> +	}
>  
>  	/* Could be one or more packages */
>  	for (i = 0; i < obj->Package.Count; i++) {
> 




More information about the fwts-devel mailing list