diff --git a/src/cpp-utils/system/memory_windows.cpp b/src/cpp-utils/system/memory_windows.cpp index 207ebd23..aabef3a7 100644 --- a/src/cpp-utils/system/memory_windows.cpp +++ b/src/cpp-utils/system/memory_windows.cpp @@ -11,7 +11,7 @@ namespace cpputils { void* UnswappableAllocator::allocate(size_t size) { void* data = DefaultAllocator().allocate(size); - const BOOL result = ::VirtualLock(addr_, len_); + const BOOL result = ::VirtualLock(data, size); if (!result) { throw std::runtime_error("Error calling VirtualLock. Errno: " + std::to_string(GetLastError())); } @@ -19,7 +19,7 @@ void* UnswappableAllocator::allocate(size_t size) { } void UnswappableAllocator::free(void* data, size_t size) { - const BOOL result = ::VirtualUnlock(addr_, len_); + const BOOL result = ::VirtualUnlock(data, size); if (!result) { LOG(WARN, "Error calling VirtualUnlock. Errno: {}", GetLastError()); }