Closed Nasty07 closed 1 year ago
The leak comes from config.c:156 cfg->interface = strdup(interface);
Maybe we need to free() the return value before updating it again?
Possible fix in #33
Looks good! Thank you for the help :)
I am going to close this for now since I merged the PR. Feel free to reopen if needed!
Also, no problem on creating the project. I'm just glad it helps others with XDP and such.
Hello and thank you for this project. It has helped me a lot to understand XDP and move forward with my own version. After testing for mem leaks using Valgrind, I think that readcfg() is leaking. What are your thoughts?
==19146== 10,425 bytes in 2,085 blocks are definitely lost in loss record 11 of 11 ==19146== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==19146== by 0x494238E: strdup (strdup.c:42) ==19146== by 0x41DCF7: readcfg (in /usr/bin/xdpfw) ==19146== by 0x41EB93: updateconfig (in /usr/bin/xdpfw) ==19146== by 0x4200E9: main (in /usr/bin/xdpfw)
Full log attached valgrind.log