From fd2fa2211dc09c9030601fde1afd2f7823b22ed8 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sat, 16 Nov 2019 21:15:59 -0800 Subject: Cleanup tabs -> spaces, actually free memory --- Source/Memory.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Source/Memory.cpp') diff --git a/Source/Memory.cpp b/Source/Memory.cpp index e240b90..d90c402 100644 --- a/Source/Memory.cpp +++ b/Source/Memory.cpp @@ -8,16 +8,17 @@ #undef PROCESSENTRY32 #undef Process32Next -Memory::Memory(const std::wstring& processName) : _processName(processName) { -} +Memory::Memory(const std::wstring& processName) : _processName(processName) {} Memory::~Memory() { if (_threadActive) { _threadActive = false; _thread.join(); } + if (_handle != nullptr) { - CloseHandle(_handle); + for (uintptr_t addr : _allocations) VirtualFreeEx(_handle, (void*)addr, 0, MEM_RELEASE); + CloseHandle(_handle); } } @@ -133,7 +134,7 @@ int Memory::ExecuteSigScans() { for (int i=0; i<0x200000; i+=0x1000) { std::vector data = ReadData({i}, 0x1100); - + for (auto& [scanBytes, sigScan] : _sigScans) { if (sigScan.found) continue; int index = find(data, scanBytes); -- cgit 1.4.1