From 18a38138e4c8fefc0a2e2df6e64076ef039ae0ee Mon Sep 17 00:00:00 2001 From: asava Date: Sat, 21 Mar 2020 18:02:01 +0200 Subject: [PATCH] Fix hang before Clover GUI caused by the use of freepool to free alligned pages --- rEFIt_UEFI/Platform/StartupSound.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rEFIt_UEFI/Platform/StartupSound.cpp b/rEFIt_UEFI/Platform/StartupSound.cpp index 76313ef65..2d9d18e86 100644 --- a/rEFIt_UEFI/Platform/StartupSound.cpp +++ b/rEFIt_UEFI/Platform/StartupSound.cpp @@ -177,9 +177,10 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile) Tmp = Next; } 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; DBG("sound converted to 48kHz\n"); - FreePool(WaveData.Samples); WaveData.Samples = (UINT8*)TempData; } else { TempData = (UINT16*)WaveData.Samples;