[posix] set up heap before creating OT instance (#6128)

This is a quick fix that allows heap usage in constructors.
This commit is contained in:
kangping
2021-01-29 07:25:42 -08:00
committed by GitHub
parent 4bb22d78de
commit c71cae350e
+3 -3
View File
@@ -92,13 +92,13 @@ otInstance *otSysInit(otPlatformConfig *aPlatformConfig)
#endif
platformRandomInit();
instance = otInstanceInitSingle();
assert(instance != nullptr);
#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
otHeapSetCAllocFree(calloc, free);
#endif
instance = otInstanceInitSingle();
assert(instance != nullptr);
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
platformBackboneInit(instance, aPlatformConfig->mBackboneInterfaceName);
#endif