From 63c6addc3053c1d05d222bbc922970efdac11110 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Mon, 12 Dec 2016 22:47:35 -0700 Subject: [PATCH] Fix new - free mismatch --- AMBuildScript | 28 ---------------------------- DynamicHooks/hook.cpp | 4 ++-- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/AMBuildScript b/AMBuildScript index fc9110f..ec14a05 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -240,8 +240,6 @@ class DHooksConfig(object): os.path.join(self.sm_root, 'sourcepawn', 'vm', 'x86'), os.path.join(self.sm_root, 'public', 'amtl', 'include'), os.path.join(self.sm_root, 'public', 'amtl', 'amtl'), - os.path.join(builder.currentSourcePath, 'DynamicHooks', 'thirdparty'), - os.path.join(builder.currentSourcePath, 'DynamicHooks', 'thirdparty', 'AsmJit'), os.path.join(builder.currentSourcePath, 'DynamicHooks'), ] @@ -274,32 +272,6 @@ program.sources += [ os.path.join('DynamicHooks', 'conventions', 'x86MsThiscall.cpp'), ] -# ASMJit -program.sources += [ - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'assembler.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'compiler.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'compilercontext.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'constpool.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'containers.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'cpuinfo.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'globals.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'hlstream.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'logger.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'operand.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'podvector.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'runtime.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'utils.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'vmem.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'base', 'zone.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'x86', 'x86assembler.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'x86', 'x86compiler.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'x86', 'x86compilercontext.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'x86', 'x86compilerfunc.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'x86', 'x86inst.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'x86', 'x86operand.cpp'), - os.path.join('DynamicHooks', 'thirdparty', 'AsmJit', 'x86', 'x86operand_regs.cpp'), -] - program.sources += [os.path.join(DHooks.sm_root, 'public', 'smsdk_ext.cpp')] if os.path.isfile(os.path.join(DHooks.sm_root, 'sourcepawn', 'vm', 'x86', 'assembler-x86.cpp')): diff --git a/DynamicHooks/hook.cpp b/DynamicHooks/hook.cpp index 6975ce5..0564bad 100644 --- a/DynamicHooks/hook.cpp +++ b/DynamicHooks/hook.cpp @@ -88,7 +88,7 @@ CHook::~CHook() copy_bytes((unsigned char *) m_pTrampoline, (unsigned char *) m_pFunc, JMP_SIZE); // Free the trampoline array - free(m_pTrampoline); + delete [] m_pTrampoline; // Free the asm bridge and new return address smutils->GetScriptingEngine()->FreePageMemory(m_pBridge); @@ -165,7 +165,7 @@ void* CHook::CreateBridge() // Call the pre-hook handler and jump to label_supercede if true was returned Write_CallHandler(masm, HOOKTYPE_PRE); - masm.cmpl(r8_al, int8_t(1)); + masm.cmpb(r8_al, true); // Restore the previously saved registers, so any changes will be applied Write_RestoreRegisters(masm);