From 8dae3fe59b0e56e99d992361ea8ac45e45052a19 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 17 Jan 2018 08:03:26 +1100 Subject: [PATCH] HAL_ChibiOS: use calloc for malloc type this is not strictly necessary on ChibiOS as we already override malloc, but will keep static analysis happy --- libraries/AP_HAL_ChibiOS/Util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/Util.cpp b/libraries/AP_HAL_ChibiOS/Util.cpp index ec3e43fa5a..2d0015cd76 100644 --- a/libraries/AP_HAL_ChibiOS/Util.cpp +++ b/libraries/AP_HAL_ChibiOS/Util.cpp @@ -52,7 +52,7 @@ void* Util::malloc_type(size_t size, AP_HAL::Util::Memory_Type mem_type) if (mem_type == AP_HAL::Util::MEM_FAST) { return try_alloc_from_ccm_ram(size); } else { - return malloc(size); + return calloc(1, size); } } @@ -69,7 +69,7 @@ void* Util::try_alloc_from_ccm_ram(size_t size) void *ret = malloc_ccm(size); if (ret == nullptr) { //we failed to allocate from CCM so we are going to try common SRAM - ret = malloc(size); + ret = calloc(1, size); } return ret; }