/* Internal function. Moves any memory descriptors that are on the temporary descriptor stack to heap.  */
VOID CoreFreeMemoryMapStack(VOID)
/* Internal function. Moves any memory descriptors that are on the temporary descriptor stack to heap.  */
VOID CoreFreeMemoryMapStack(VOID)
{
  MEMORY_MAP  *Entry;
  if (mFreeMapStack != 0) {
    ASSERT (FALSE);
    return;
  }
  mFreeMapStack += 1;
  while (mMapDepth != 0) {
    Entry = AllocateMemoryMapEntry ();
    ASSERT (Entry);
    mMapDepth -= 1;
    if (mMapStack[mMapDepth].Link.ForwardLink != NULL) {
      CopyMem (Entry, &mMapStack[mMapDepth], sizeof (MEMORY_MAP));
      Entry->FromStack = FALSE;
      InsertTailList (&mMapStack[mMapDepth].Link, &Entry->Link);
      RemoveEntryList (&mMapStack[mMapDepth].Link);
      mMapStack[mMapDepth].Link.ForwardLink = NULL;
    }
  }
  mFreeMapStack -= 1;
}