From a99b690d49f242bfaa4a23261c67990b7ad52272 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Jan 2018 08:02:46 +1100 Subject: [PATCH] HAL_PX4: use calloc for malloc_type() this ensures that EKF memory is zero on start --- libraries/AP_HAL_PX4/Util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_PX4/Util.cpp b/libraries/AP_HAL_PX4/Util.cpp index 731c8ef461..ea338bd1fe 100644 --- a/libraries/AP_HAL_PX4/Util.cpp +++ b/libraries/AP_HAL_PX4/Util.cpp @@ -250,10 +250,10 @@ void *PX4Util::malloc_type(size_t size, AP_HAL::Util::Memory_Type mem_type) if (mem_type == AP_HAL::Util::MEM_DMA_SAFE) { return fat_dma_alloc(size); } else { - return malloc(size); + return calloc(1, size); } #else - return malloc(size); + return calloc(1, size); #endif } void PX4Util::free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_type)