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
This commit is contained in:
Andrew Tridgell 2018-01-17 08:03:26 +11:00
parent a99b690d49
commit 8dae3fe59b

View File

@ -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) { if (mem_type == AP_HAL::Util::MEM_FAST) {
return try_alloc_from_ccm_ram(size); return try_alloc_from_ccm_ram(size);
} else { } 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); void *ret = malloc_ccm(size);
if (ret == nullptr) { if (ret == nullptr) {
//we failed to allocate from CCM so we are going to try common SRAM //we failed to allocate from CCM so we are going to try common SRAM
ret = malloc(size); ret = calloc(1, size);
} }
return ret; return ret;
} }