Fix endless recursion on webui_malloc in debug mode. - #655
Conversation
We're sure the length of the debug message of _webui_malloc < 256, so in that case we have enough room to print the debug message without allocating memory with _webui_malloc, which prevents an endless recursion to _webui_log. Signed-off-by: Hans Dijkema <hans@dijkewijk.nl>
Can you please show me where is that? because I can't find it. Another main reason is that |
|
I see, good catch. To fix this endless recursion and at the same time be thread-safe I suggest keeping dynamic allocation but using |
|
That is fine by me, although I think stack allocation of a character array may have some advantages over heap allocation.
And allocating on the stack is afaik thread safe. By using a local array of decent size, the majority of debug cases there's probably no malloc/free needed |
Sorry I read the modification quick, and I taught the buffer was |

Fix endless recursion on webui_malloc in debug mode.
We're sure the length of the debug message of _webui_malloc < 256,
so in that case we have enough room to print the debug message
without allocating memory with _webui_malloc, which prevents
an endless recursion to _webui_log.