Fix hang before Clover GUI caused by the use of freepool to free alligned pages

This commit is contained in:
asava 2020-03-21 18:02:01 +02:00
parent 14cdfe29c7
commit 18a38138e4

View File

@ -177,9 +177,10 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
Tmp = Next; Tmp = Next;
} }
freq = EfiAudioIoFreq48kHz; freq = EfiAudioIoFreq48kHz;
// Samples was allocated via AllocateAlignedPages, so it must not be freed with FreePool, but according to the number of pages allocated
FreePages(WaveData.Samples,EFI_SIZE_TO_PAGES(WaveData.SamplesLength+4095));
WaveData.SamplesLength *= 6; WaveData.SamplesLength *= 6;
DBG("sound converted to 48kHz\n"); DBG("sound converted to 48kHz\n");
FreePool(WaveData.Samples);
WaveData.Samples = (UINT8*)TempData; WaveData.Samples = (UINT8*)TempData;
} else { } else {
TempData = (UINT16*)WaveData.Samples; TempData = (UINT16*)WaveData.Samples;