From a73f4b9eed5f9e85db84f7d2d99b54da4a44b538 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Sat, 27 Jun 2026 17:34:07 +0200 Subject: [PATCH 1/2] fixed wrong usage of VirtualFree (win32) SecureAlloc should have never even compiled on win32. First, the API usage is wrong - VirtualFree requires a size parameter (0 in case of MEM_RELEASE). Second, the deallocator used a non existing variable name as reference. This change fixes the usage, but the change itself is untested. --- src/lib/data_mgr/SecureAllocator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/data_mgr/SecureAllocator.h b/src/lib/data_mgr/SecureAllocator.h index 71dc80c7b..e440767cc 100644 --- a/src/lib/data_mgr/SecureAllocator.h +++ b/src/lib/data_mgr/SecureAllocator.h @@ -122,7 +122,7 @@ template class SecureAllocator #ifndef _WIN32 free(r); #else - VirtualFree((const void*) r, MEM_RELEASE); + VirtualFree((const void*) r, 0, MEM_RELEASE); #endif return NULL; @@ -173,7 +173,7 @@ template class SecureAllocator #ifndef _WIN32 free(p); #else - VirtualFree((const void*) r, MEM_RELEASE); + VirtualFree((const void*) p, 0, MEM_RELEASE); #endif #else // Release the memory From 951b77af554b7fd243726db6b9f1405564b4c916 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Sat, 27 Jun 2026 17:39:47 +0200 Subject: [PATCH 2/2] fixed more usages of VirtualFree() --- src/lib/data_mgr/salloc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/data_mgr/salloc.cpp b/src/lib/data_mgr/salloc.cpp index 0bd423804..5ab4d95f7 100644 --- a/src/lib/data_mgr/salloc.cpp +++ b/src/lib/data_mgr/salloc.cpp @@ -71,7 +71,7 @@ void* salloc(size_t len) #ifndef _WIN32 free(ptr); #else - VirtualFree((const void*) pre, MEM_RELEASE); + VirtualFree((const void*) pre, 0, MEM_RELEASE); #endif return NULL; @@ -116,7 +116,7 @@ void sfree(void* ptr) #ifndef _WIN32 munlock((const void*) ptr, len); #else - VirtualFree((const void*) pre, MEM_RELEASE); + VirtualFree((const void*) pre, 0, MEM_RELEASE); #endif #endif // SENSITIVE_NON_PAGED