Skip to content

Commit a0955fc

Browse files
Thom747MichalPrincNXP
authored andcommitted
Fix calling pvPortMalloc on FreeRTOS with size zero resulting in vApplicationMallocFailedHook getting called and FreeRTOS asserting
1 parent 6e7ccf2 commit a0955fc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

erpc_c/port/erpc_port_freertos.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ void operator delete[](void *ptr) THROW
5555

5656
void *erpc_malloc(size_t size)
5757
{
58+
if (size == 0)
59+
{
60+
return nullptr;
61+
}
5862
void *p = pvPortMalloc(size);
5963
return p;
6064
}

0 commit comments

Comments
 (0)