diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index b2c180161..04652599f 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -571,6 +571,9 @@ NsConvertEntryToHandle(NAME_TABLE_ENTRY *Nte) void NsTerminate (void) { + ACPI_OBJECT_INTERNAL *ObjDesc; + + FUNCTION_TRACE ("NsTerminate"); @@ -582,14 +585,19 @@ NsTerminate (void) /* Detach any object(s) attached to the root */ - NsDetachObject (Gbl_RootObject); + ObjDesc = NsGetAttachedObject (Gbl_RootObject); + if (ObjDesc) + { + NsDetachObject (Gbl_RootObject); + CmDeleteInternalObject (ObjDesc); + } + NsDeleteScope (Gbl_RootObject->Scope); Gbl_RootObject->Scope = NULL; REPORT_SUCCESS ("Entire namespace and objects deleted"); - NsScopeStackClear (); CmFree (Gbl_CurrentScope); /* Free the root scope */