I'm a P.hD student and I detected that the code below has a weakness, but it was not detected by cppcheck. I tried to fix it by changing the cppcheck but I couldn't until now, could you guys fix this or give me some steps to achieve this?
Thanks! It seems it's not about dlopen. We don't detect such leak in loops at all. Cppcheck still doesn't detect the leak if you replace "dlopen" with "malloc" in your code.
Hi everyone,
I'm a P.hD student and I detected that the code below has a weakness, but it was not detected by cppcheck. I tried to fix it by changing the cppcheck but I couldn't until now, could you guys fix this or give me some steps to achieve this?
Thanks! It seems it's not about dlopen. We don't detect such leak in loops at all. Cppcheck still doesn't detect the leak if you replace "dlopen" with "malloc" in your code.
I have created https://trac.cppcheck.net/ticket/10815
I wonder if you would like to look into that. It is old code so I don't remember a lot about it. But hope you can understand how it works.
Last edit: Daniel Marjamäki 2022-02-17
Thanks for the feedback!
Hi @danielmarjamaki,
I observed that when we are dealing with member of struct cppcheck detects the memory leak even inside the loop. Maybe this information will help
output: test.c:11:1: error: Memory leak: vec.data [memleak]
Regards
Last edit: Kleber Santos 2022-02-19