Faild use of Mutexs in the CORTEX_MPS2_QEMU_IAR

I was trying to replicate the example you can find on the FreeRTOS book about the mutex on page 249, and i am using the CORTEX_MPS2_QEMU_IAR.
It compiles but when i try to execute it says “Unexpected call to malloc() - should be usine pvPortMalloc()”.
I m not directly calling malloc but in the code example we are calling xSemaphoreCreateMutex(), which i guess is using malloc
How should i solve it?

That is not correct - xSemaphoreCreateMutex calls xQueueGenericCreate which calls pvPortMalloc - FreeRTOS-Kernel/queue.c at main · FreeRTOS/FreeRTOS-Kernel · GitHub.

Can you search for the line “Unexpected call to malloc() - should be usine pvPortMalloc()” in your code and put a breakpoint there to find out where the call is coming from?