Author: ekohl Date: Sun Jun 28 15:41:18 2015 New Revision: 68303
URL: http://svn.reactos.org/svn/reactos?rev=68303&view=rev Log: [CMLIB] HvFree: - Free the BaseBlock. - Do not free the hive itself because the HHIVE is part of the CMHIVE structure and freeing it here could be an unpleasant surprise.
[NTOSKRNL] CmpDestroyHive: Free the CMHIVE after calling HvFree. CmUnloadKey: Free the hive storage, the hive locks and the CMHIVE properly.
Modified: trunk/reactos/lib/cmlib/hiveinit.c trunk/reactos/ntoskrnl/config/cmapi.c trunk/reactos/ntoskrnl/config/cminit.c
Modified: trunk/reactos/lib/cmlib/hiveinit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hiveinit.c?rev=68... ============================================================================== --- trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] (original) +++ trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] Sun Jun 28 15:41:18 2015 @@ -529,6 +529,7 @@ * @name HvFree * * Free all stroage and handles associated with hive descriptor. + * But do not free the hive descriptor itself. */
VOID CMAPI @@ -544,9 +545,14 @@ }
HvpFreeHiveBins(RegistryHive); - } - - RegistryHive->Free(RegistryHive, 0); + + /* Free the BaseBlock */ + if (RegistryHive->BaseBlock) + { + RegistryHive->Free(RegistryHive->BaseBlock, 0); + RegistryHive->BaseBlock = NULL; + } + } }
/* EOF */
Modified: trunk/reactos/ntoskrnl/config/cmapi.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmapi.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/config/cmapi.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cmapi.c [iso-8859-1] Sun Jun 28 15:41:18 2015 @@ -2241,7 +2241,20 @@ /* Remove the hive from the hive file list */ CmpRemoveFromHiveFileList(CmHive);
- /* FIXME: Destroy the hive */ + /* FIXME: More cleanup */ + + /* Free the hive storage */ + HvFree(Hive); + + /* Delete the flusher lock */ + ExDeleteResourceLite(CmHive->FlusherLock); + ExFreePoolWithTag(CmHive->FlusherLock, TAG_CM); + + /* Delete the view lock */ + ExFreePoolWithTag(CmHive->ViewLock, TAG_CM); + + /* Free the hive */ + CmpFree(CmHive, TAG_CM);
return STATUS_SUCCESS; }
Modified: trunk/reactos/ntoskrnl/config/cminit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cminit.c?re... ============================================================================== --- trunk/reactos/ntoskrnl/config/cminit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cminit.c [iso-8859-1] Sun Jun 28 15:41:18 2015 @@ -257,8 +257,11 @@ /* Delete the view lock */ ExFreePoolWithTag(CmHive->ViewLock, TAG_CM);
+ /* Free the hive storage */ + HvFree(&CmHive->Hive); + /* Free the hive */ - HvFree(&CmHive->Hive); + CmpFree(CmHive, TAG_CM);
return STATUS_SUCCESS; }