diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/allocator.cpp | 3 | ||||
-rw-r--r-- | tests/main.cpp | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/allocator.cpp b/tests/allocator.cpp index 3641585..094d5e5 100644 --- a/tests/allocator.cpp +++ b/tests/allocator.cpp @@ -1,6 +1,7 @@ #include "allocator.hpp" #include <string.h> +#include <assert.h> // Low-level allocation functions #if defined(_WIN32) || defined(_WIN64) @@ -97,6 +98,8 @@ void* memory_allocate(size_t size) size_t memory_size(void* ptr) { + assert(ptr); + size_t result; memcpy(&result, static_cast<size_t*>(ptr) - 1, sizeof(size_t)); diff --git a/tests/main.cpp b/tests/main.cpp index 3bcf9be..75b0108 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -34,6 +34,7 @@ static void* custom_allocate(size_t size) else { void* ptr = memory_allocate(size); + assert(ptr); g_memory_total_size += memory_size(ptr); g_memory_total_count++; |