aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/SecureMemoryAllocator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/function/SecureMemoryAllocator.cpp')
-rw-r--r--src/core/function/SecureMemoryAllocator.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/core/function/SecureMemoryAllocator.cpp b/src/core/function/SecureMemoryAllocator.cpp
index c24e13f2..47301038 100644
--- a/src/core/function/SecureMemoryAllocator.cpp
+++ b/src/core/function/SecureMemoryAllocator.cpp
@@ -28,42 +28,22 @@
#include "SecureMemoryAllocator.h"
-namespace GpgFrontend {
+#include <cstdlib>
-#if defined(__APPLE__) && defined(__MACH__)
+namespace GpgFrontend {
auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* {
- auto* addr = malloc(size);
+ auto* addr = std::malloc(size);
if (addr == nullptr) FLOG_F("malloc failed!");
return addr;
}
auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* {
- auto* addr = realloc(ptr, size);
+ auto* addr = std::realloc(ptr, size);
if (addr == nullptr) FLOG_F("realloc failed!");
return addr;
}
-void SecureMemoryAllocator::Deallocate(void* p) { free(p); }
-
-#else
-
-#include <mimalloc.h>
-
-auto SecureMemoryAllocator::Allocate(std::size_t size) -> void* {
- auto* addr = mi_malloc(size);
- if (addr == nullptr) FLOG_F("malloc failed!");
- return addr;
-}
-
-auto SecureMemoryAllocator::Reallocate(void* ptr, std::size_t size) -> void* {
- auto* addr = mi_realloc(ptr, size);
- if (addr == nullptr) FLOG_F("realloc memory failed!");
- return addr;
-}
-
-void SecureMemoryAllocator::Deallocate(void* p) { mi_free(p); }
-
-#endif
+void SecureMemoryAllocator::Deallocate(void* p) { std::free(p); }
} // namespace GpgFrontend \ No newline at end of file