Closed omalaspinas closed 10 months ago
I made some verification and the memory leak is not due to the foreach macro itself, but it's from the "polymorophic" function call __clove_cmdline_errno_t result = (*handler)(&cmdline);
There are some vectors stored in map that that are not properly freed. Now, I remember that I did it on purpose to avoid to make complex memory management in that case (considering the fact we are in a test library and leaks are negligible related to data related to library itself and that data are just stored once and then freed at the end of test execution)
Anyhow, this could be improved
Hello,
when compiling with sanitizers (I used memory, leaks, and undefined), I get a memory leak during the call to the following macro call (I guess it returns early and some temporary malloc is not freed)
I tried to fix it by using various free functions but did not manage to make it pass the CI tests. I'm probably missing some understanding in here. In particular I tried adding
on the other branch of the if but I guess it frees too much (it indeed removes the memory leak but..... then no test is executed anymore in the CI...).
To add the sanitizers you can add the following lines in the CMakeLists.txt files:
Edit: formatting.