diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index 19ac4f33d..c2c9be484 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -793,12 +793,10 @@ void NotifyMemoryFree(void* Address, SIZE_T Size, ULONG FreeType, BOOL After, NT if (!After) { ThreadCreationMutex.lock(); - if (FreeType & MEM_DECOMMIT) { - InvalidationTracker->InvalidateAlignedInterval(reinterpret_cast(Address), static_cast(Size), true); - } else if (FreeType & MEM_RELEASE) { - InvalidationTracker->InvalidateContainingSection(reinterpret_cast(Address), true); - } } else { + if (!Status) { + InvalidationTracker->InvalidateAlignedInterval(reinterpret_cast(Address), static_cast(Size), true); + } ThreadCreationMutex.unlock(); } } diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index dfd015582..23dbf679b 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -966,12 +966,10 @@ void BTCpuNotifyMemoryProtect(void* Address, SIZE_T Size, ULONG NewProt, BOOL Af void BTCpuNotifyMemoryFree(void* Address, SIZE_T Size, ULONG FreeType, BOOL After, ULONG Status) { if (!After) { ThreadCreationMutex.lock(); - if (!Size) { - InvalidationTracker->InvalidateContainingSection(reinterpret_cast(Address), true); - } else if (FreeType & MEM_DECOMMIT) { + } else { + if (!Status) { InvalidationTracker->InvalidateAlignedInterval(reinterpret_cast(Address), static_cast(Size), true); } - } else { ThreadCreationMutex.unlock(); } }