diff --git a/libraries/AP_MultiHeap/MultiHeap_malloc.cpp b/libraries/AP_MultiHeap/MultiHeap_malloc.cpp index 857d01e76bfc82..65f1698380ff9c 100644 --- a/libraries/AP_MultiHeap/MultiHeap_malloc.cpp +++ b/libraries/AP_MultiHeap/MultiHeap_malloc.cpp @@ -36,9 +36,10 @@ void *MultiHeap::heap_create(uint32_t size) { struct heap *new_heap = (struct heap*)malloc(sizeof(struct heap)); if (new_heap != nullptr) { + new_heap->magic = HEAP_MAGIC; new_heap->max_heap_size = size; + new_heap->current_heap_usage = 0; } - new_heap->magic = HEAP_MAGIC; return (void *)new_heap; }