Skip to contentSkip to conversation

iASL/Disassembler: nullify AcpiGbl_ParseOpRoot after deleting parse tree

PATCH New Colin King 1 participant 1 message Feb 19, 2016 ACPI component architecture (acpica)

lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 iASL/Disassembler: nullify AcpiGbl_ParseOpRoot after deleting parse tree

From: Colin Ian King <colin.king(a)canonical.com>

On i386 platforms with glibc 2.21 and gcc 6.0 I'm getting double frees on the heap when disassembling with iASL using multiple external tables. The current code deletes the parse tree from the AcpiGbl_ParseOpRoot and not NULLifying it afterwards, causing subsequent tree parsing to re-add existing heap objects back onto this root node causing subsequent parse tree deletes to trip the double free.

Interestingly, this seems to only happen in some configurations so I believe it works on 64 bit x86 and not 32 bit because of heap differences in the libc allocator.

Signed-off-by Colin Ian King <colin.king(a)canonical.com>
---
 source/common/adisasm.c | 1 +
 1 file changed, 1 insertion(+)
source/common/adisasm.c +1 -0
index 3dabe3b..520863c 100644
@@ -700,6 +700,7 @@ AdDoExternalFileList (
             AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
                 AcpiGbl_RootNode, OwnerId);
             AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
+            AcpiGbl_ParseOpRoot = NULL;
 
             ExternalListHead = ExternalListHead->Next;
         }
Signature · 1 line
2.7.0