ACK: [PATCH] acpi: madt: fix memory leak on return paths
Alex Hung
alex.hung at canonical.com
Sat Jul 30 13:11:48 UTC 2016
On 2016-07-29 11:47 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> several error return paths are not freeing allocatd resources
> leading to a memory leak. Fix this by free'ing the allocation
> before returning.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpi/madt/madt.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/acpi/madt/madt.c b/src/acpi/madt/madt.c
> index 257d7d9..3505f62 100644
> --- a/src/acpi/madt/madt.c
> +++ b/src/acpi/madt/madt.c
> @@ -265,23 +265,30 @@ static ACPI_STATUS madt_processor_handler(ACPI_HANDLE ObjHandle, uint32_t level,
> return (!AE_OK);
>
> status = AcpiGetType(ObjHandle, &acpi_type);
> - if (ACPI_FAILURE(status))
> + if (ACPI_FAILURE(status)) {
> + free(listint);
> return (!AE_OK);
> + }
>
> switch(acpi_type) {
> case ACPI_TYPE_PROCESSOR:
> status = AcpiEvaluateObject(ObjHandle, NULL, NULL, &pbuf);
> - if (ACPI_FAILURE(status))
> + if (ACPI_FAILURE(status)) {
> + free(listint);
> return status;
> + }
> listint->value = processor.proc_id;
> break;
> case ACPI_TYPE_DEVICE:
> status = AcpiEvaluateObject(ObjHandle, "_UID", NULL, &ibuf);
> - if (ACPI_FAILURE(status))
> + if (ACPI_FAILURE(status)) {
> + free(listint);
> return status;
> + }
> listint->value = integer.value;
> break;
> default:
> + free(listint);
> return (!AE_OK);
> }
> listint->type = acpi_type;
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list