Skip to content

Commit c27bac0

Browse files
SchmErikrafaeljw
authored andcommitted
ACPICA: Fix memory leak caused by _CID repair function
ACPICA commit 180cb53963aa876c782a6f52cc155d951b26051a According to the ACPI spec, _CID returns a package containing hardware ID's. Each element of an ASL package contains a reference count from the parent package as well as the element itself. Name (TEST, Package() { "String object" // this package element has a reference count of 2 }) A memory leak was caused in the _CID repair function because it did not decrement the reference count created by the package. Fix the memory leak by calling acpi_ut_remove_reference on _CID package elements that represent a hardware ID (_HID). Link: acpica/acpica@180cb539 Tested-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Erik Kaneda <erik.kaneda@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 8288f69 commit c27bac0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/acpi/acpica/nsrepair2.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info,
379379

380380
(*element_ptr)->common.reference_count =
381381
original_ref_count;
382+
383+
/*
384+
* The original_element holds a reference from the package object
385+
* that represents _HID. Since a new element was created by _HID,
386+
* remove the reference from the _CID package.
387+
*/
388+
acpi_ut_remove_reference(original_element);
382389
}
383390

384391
element_ptr++;

0 commit comments

Comments
 (0)