Bugzilla – Bug 383
Incomplete cleanup branch in AcpiUtUpdateObjectReference in case of Package
Last modified: 2008-09-26 19:56:26
You need to log in before you can comment on or make changes to this bug.
ACPICA API Test Suite detects the next problem. There is incomplete cleanup branch in the code of the function AcpiUtUpdateObjectReference (file utilities/utdelete.c): for (i = 0; i < Object->Package.Count; i++) { /* * Push each element onto the stack for later processing. * Note: There can be null elements within the package, * these are simply ignored */ Status = AcpiUtCreateUpdateStateAndPush ( Object->Package.Elements[i], Action, &StateList); if (ACPI_FAILURE (Status)) { goto ErrorExit; } } ... ErrorExit: ACPI_EXCEPTION ((AE_INFO, Status, "Could not update object reference count")); return_ACPI_STATUS (Status); On testing conditions when the AcpiUtCreateUpdateStateAndPush returns the AE_NO_MEMORY due to memory allocation problems, the AcpiUtUpdateObjectReference is leaved without the Update States deletion that leads to memory leak. Perhaps, the AcpiUtUpdateObjectReference code could be updated to something like following: ErrorExit: ACPI_EXCEPTION ((AE_INFO, Status, "Could not update object reference count")); + /* Free allocated Update States */ + while (StateList) + { + State = AcpiUtPopGenericState (&StateList); + AcpiUtDeleteGenericState (State); + } return_ACPI_STATUS (Status); INTERNAL API TS BUG NUMBER: 28
Created an attachment (id=782) [details] patch from the reporter This patch from the reporter fixes the possible memory leak We should ship it to next release
Bob, Would you please have a look at the patch at comment #1?
AcpiUtCreateUpdateStateAndPush is only called at AcpiUtUpdateObjectReference. So this patch is sufficient to fix the possible memory leak.
Created an attachment (id=798) [details] proposed patch found another similar possible memory leak in AcpiUtWalkPackageTree. The final patch attached.
ship in ACPICA release 20080926