[NTOSKRNL]

Fix CmpDestroyHiveViewList adding checks for empty lists.

Thank you very much Thomas!

svn path=/trunk/; revision=68315
This commit is contained in:
Eric Kohl 2015-06-29 20:29:19 +00:00
parent 9826966d55
commit d25d5b8cec

View file

@ -34,7 +34,6 @@ VOID
NTAPI NTAPI
CmpDestroyHiveViewList(IN PCMHIVE Hive) CmpDestroyHiveViewList(IN PCMHIVE Hive)
{ {
#if 0
PCM_VIEW_OF_FILE CmView; PCM_VIEW_OF_FILE CmView;
PLIST_ENTRY EntryList; PLIST_ENTRY EntryList;
@ -42,9 +41,10 @@ CmpDestroyHiveViewList(IN PCMHIVE Hive)
ASSERT(Hive->Hive.ReadOnly == FALSE); ASSERT(Hive->Hive.ReadOnly == FALSE);
/* Free all the views inside the Pinned View List */ /* Free all the views inside the Pinned View List */
EntryList = RemoveHeadList(&Hive->PinViewListHead); while (!IsListEmpty(&Hive->PinViewListHead))
while (EntryList != &Hive->PinViewListHead)
{ {
EntryList = RemoveHeadList(&Hive->PinViewListHead);
CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, PinViewList); CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, PinViewList);
/* FIXME: Unmap the view if it is mapped */ /* FIXME: Unmap the view if it is mapped */
@ -52,8 +52,6 @@ CmpDestroyHiveViewList(IN PCMHIVE Hive)
ExFreePool(CmView); ExFreePool(CmView);
Hive->PinnedViews--; Hive->PinnedViews--;
EntryList = RemoveHeadList(&Hive->PinViewListHead);
} }
/* The Pinned View List should be empty */ /* The Pinned View List should be empty */
@ -61,9 +59,10 @@ CmpDestroyHiveViewList(IN PCMHIVE Hive)
ASSERT(Hive->PinnedViews == 0); ASSERT(Hive->PinnedViews == 0);
/* Now, free all the views inside the LRU View List */ /* Now, free all the views inside the LRU View List */
EntryList = RemoveHeadList(&Hive->LRUViewListHead); while (!IsListEmpty(&Hive->LRUViewListHead))
while (EntryList != &Hive->LRUViewListHead)
{ {
EntryList = RemoveHeadList(&Hive->LRUViewListHead);
CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, LRUViewList); CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, LRUViewList);
/* FIXME: Unmap the view if it is mapped */ /* FIXME: Unmap the view if it is mapped */
@ -71,14 +70,11 @@ CmpDestroyHiveViewList(IN PCMHIVE Hive)
ExFreePool(CmView); ExFreePool(CmView);
Hive->MappedViews--; Hive->MappedViews--;
EntryList = RemoveHeadList(&Hive->LRUViewListHead);
} }
/* The LRU View List should be empty */ /* The LRU View List should be empty */
ASSERT(IsListEmpty(&Hive->LRUViewListHead) == TRUE); ASSERT(IsListEmpty(&Hive->LRUViewListHead) == TRUE);
ASSERT(Hive->MappedViews == 0); ASSERT(Hive->MappedViews == 0);
#endif
} }
/* EOF */ /* EOF */