Add debug_calloc() to the debug_heap.

This commit is contained in:
Michael Lotz 2012-07-01 05:36:45 +02:00
parent d58aadcdca
commit fcc4ecb0c7
2 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,7 @@ extern "C" {
debug_alloc_pool* create_debug_alloc_pool();
void delete_debug_alloc_pool(debug_alloc_pool* pool);
void* debug_malloc(size_t size);
void* debug_calloc(size_t num, size_t size);
void debug_free(void* address);
void debug_heap_init();

View File

@ -278,6 +278,19 @@ debug_malloc(size_t size)
}
void*
debug_calloc(size_t num, size_t size)
{
size_t allocationSize = num * size;
void* allocation = debug_malloc(allocationSize);
if (allocation == NULL)
return NULL;
memset(allocation, 0, allocationSize);
return allocation;
}
void
debug_free(void* address)
{