mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-31 13:08:34 -04:00
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:
parent
a99b690d49
commit
8dae3fe59b
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user