Fix a DHook crash when unloading dynamic detours on x86_64 arch (#2288)
Some checks failed
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang, clang++, ubuntu-latest, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (clang-8, clang++-8, ubuntu-20.04, linux) (push) Has been cancelled
Continuous Integration / ${{ matrix.os_short }}-${{ matrix.compiler_cc }} (msvc, windows-latest, win) (push) Has been cancelled
hl2sdk-mock tests / mock (push) Has been cancelled

This commit is contained in:
rtldg 2025-02-28 20:33:55 +00:00 committed by GitHub
parent d5e05fae59
commit 87653bf780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,10 +88,13 @@ CHook::~CHook()
m_Hook.disable(); m_Hook.disable();
} }
// x64 will free these in the m_bridge/m_postCallback destructors.
#ifndef DYNAMICHOOKS_x86_64
if (m_pBridge) { if (m_pBridge) {
smutils->GetScriptingEngine()->FreePageMemory(m_pBridge); smutils->GetScriptingEngine()->FreePageMemory(m_pBridge);
smutils->GetScriptingEngine()->FreePageMemory(m_pNewRetAddr); smutils->GetScriptingEngine()->FreePageMemory(m_pNewRetAddr);
} }
#endif
delete m_pRegisters; delete m_pRegisters;
delete m_pCallingConvention; delete m_pCallingConvention;