I have been looking into what the implementation of snprintf does. It seems it is using some dynamic memory using malloc().
Way back I found some resource telling me to use pvPortMalloc and vPortFree instead of the normal malloc and free. I am using FreeRTOS with heap4.
Could it be the call to malloc causing problems because I am using FreeRTOS?