mirror of
https://github.com/espressif/openthread.git
synced 2026-08-19 08:59:52 +00:00
[heap] fix external heap configuration (#6123)
The Instance::HeapCAlloc() method can not be used in constructors when EXTERNAL_HEAP is enabled but works well when internal heap is used. This is because the external heap methods are set by public otHeapSetCAllocFree API after the OT instance is constructed. This commit fixes this issue by having Instance::HeapCAlloc() using otPlatCAlloc when EXTERNAL_HEAP is enabled. It also fixes build issues when MULTIPLE_INSTANCE and EXTERNAL_HEAP are used together.
This commit is contained in:
@@ -94,7 +94,7 @@ bool sDiagMode = false;
|
||||
|
||||
extern "C" {
|
||||
|
||||
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
|
||||
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
|
||||
void *otPlatCAlloc(size_t aNum, size_t aSize)
|
||||
{
|
||||
return calloc(aNum, aSize);
|
||||
|
||||
Reference in New Issue
Block a user