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.

svn path=/trunk/; revision=68303
This commit is contained in:
Eric Kohl 2015-06-28 15:41:18 +00:00
parent fbff7e0e47
commit 2423b35126
3 changed files with 26 additions and 4 deletions

View file

@ -529,6 +529,7 @@ HvInitialize(
* @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 @@ HvFree(
}
HvpFreeHiveBins(RegistryHive);
}
RegistryHive->Free(RegistryHive, 0);
/* Free the BaseBlock */
if (RegistryHive->BaseBlock)
{
RegistryHive->Free(RegistryHive->BaseBlock, 0);
RegistryHive->BaseBlock = NULL;
}
}
}
/* EOF */

View file

@ -2241,7 +2241,20 @@ CmUnloadKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
/* 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;
}

View file

@ -257,9 +257,12 @@ CmpDestroyHive(IN PCMHIVE CmHive)
/* Delete the view lock */
ExFreePoolWithTag(CmHive->ViewLock, TAG_CM);
/* Free the hive */
/* Free the hive storage */
HvFree(&CmHive->Hive);
/* Free the hive */
CmpFree(CmHive, TAG_CM);
return STATUS_SUCCESS;
}