ACK: [PATCH][V2] acpi: method: fix two memory leaks on error return paths
Alex Hung
alex.hung at canonical.com
Mon Feb 22 02:45:06 UTC 2021
On 2021-02-19 6:02 a.m., 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);
> return;
> + }
>
> /* Could be one or more packages */
> for (i = 0; i < obj->Package.Count; i++) {
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list