coreboot-kgpe-d16/src/acpi
Simon Glass 8bfa51e4c4 acpi: Avoid freeing a device twice
The current implementation of acpi_dp_write() frees the node after it
has written it.

If the structure contains a ACPI_DP_TYPE_CHILD then a recursive call to
acpi_dp_write() frees the child and then frees it again when returning
from the call. This results in a double free.

Split the implementation into two steps, one that ones and one that
frees. This is easier to understand and fixes the bug.

Note: This likely has no effect in coreboot since it doesn't seem to
have a proper free() implementation. But it might gain one one day.

BUG=none

Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: Ife3917af10bc35a3c3eee38d8292f927ef15409d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42892
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-07-01 04:52:47 +00:00
..
Kconfig ACPI: Replace smm_setup_structures() 2020-06-24 11:49:15 +00:00
Makefile.inc ACPI: Add framework for GNVS initialisation 2020-06-24 11:46:26 +00:00
acpi.c ACPI: Remove Kconfig COMMON_FADT 2020-06-10 12:53:08 +00:00
acpigen.c acpigen: Add some new helper functions 2020-06-03 04:06:14 +00:00
acpigen_dsm.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
acpigen_ps2_keybd.c acpigen_ps2_keybd: Add keymap for Power key 2020-05-15 03:52:39 +00:00
acpigen_usb.c acpi: Add new file for implementing Type-C Connector class 2020-05-28 23:54:43 +00:00
chromeos-gnvs.c ACPI: Add framework for GNVS initialisation 2020-06-24 11:46:26 +00:00
device.c acpi: Avoid freeing a device twice 2020-07-01 04:52:47 +00:00
gnvs.c ACPI: Add framework for GNVS initialisation 2020-06-24 11:46:26 +00:00
pld.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
sata.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
soundwire.c acpi/soundwire: Add functions to generate SoundWire properties 2020-05-21 08:04:02 +00:00