Description of problem: Attempting to open use netcf from an unprivileged user results in a huge memory leak. This in turns causes libvirtd to leak memory when run as a non-root user. Version-Release number of selected component (if applicable): 0.1.4 How reproducible: Always, when used as non-root Steps to Reproduce: 1. Compile the following #include <stdio.h> int main(int argc, char **argv) { for (int i = 0 ; i < 1000000 ; i++) { struct netcf *netcf = NULL; ncf_init(&netcf, NULL); if (netcf != NULL) { ncf_close(netcf); } } return 0; } 2. Run it as non-root & watch it with 'top' 3. Actual results: Consumes 100's of MB Expected results: Additional info:
Created attachment 373113 [details] Fix memory leak in ncf_open() cleanup path
Thanks for the patch. Fixed upstream by commit 42fd804f (I still see a small leak ~300 bytes from libnl in valgrind, but the leak is orders of magnitute smaller now)
Hmm, assuming you've already committed my other reported fix, would the remaining leaks you be these ones.... ? ==22396== 16 bytes in 1 blocks are possibly lost in loss record 526 of 1,826 ==22396== at 0x4004F1B: calloc (vg_replace_malloc.c:418) ==22396== by 0x52CD887: add_routing_table_name (netlink-local.h:131) ==22396== by 0x52CD96A: init_routing_table_names (route_utils.c:63) ==22396== by 0x52DF63C: ??? (in /usr/lib/libnl.so.1.1) ==22396== by 0x52B0843: ??? (in /usr/lib/libnl.so.1.1) ==22396== by 0x20B8DB: call_init (dl-init.c:70) ==22396== by 0x20BA40: _dl_init (dl-init.c:134) ==22396== by 0x1FD88E: ??? (in /lib/ld-2.11.so) if so, those are harmless since they're static variable initialization and not intended to be freed
I get something slightly different (on F11): ==29719== 128 bytes in 4 blocks are possibly lost in loss record 13 of 23 ==29719== at 0x4A05414: calloc (vg_replace_malloc.c:397) ==29719== by 0x31DEE2BCF7: (within /usr/lib64/libnl.so.1.1) ==29719== by 0x31DEE2BDA1: (within /usr/lib64/libnl.so.1.1) ==29719== by 0x31DEE3A6D5: (within /usr/lib64/libnl.so.1.1) ==29719== by 0x31DEE13412: (within /usr/lib64/libnl.so.1.1) ==29719== ==29719== ==29719== 160 bytes in 5 blocks are possibly lost in loss record 15 of 23 ==29719== at 0x4A05414: calloc (vg_replace_malloc.c:397) ==29719== by 0x31DEE2BF17: (within /usr/lib64/libnl.so.1.1) ==29719== by 0x31DEE2BFC1: (within /usr/lib64/libnl.so.1.1) ==29719== by 0x31DEE3A6D5: (within /usr/lib64/libnl.so.1.1) ==29719== by 0x31DEE13412: (within /usr/lib64/libnl.so.1.1) I haven't been able to get valgrind to use libnl debuginfo for more enlightening stacktraces - maybe once I upgrade to F12. All I am doing is running <pre> valgrind --leak-check=full /data/share/bin/ncftool <<EOF quit EOF </pre>
netcf-0.1.5-1.fc12 has been submitted as an update for Fedora 12. http://admin.fedoraproject.org/updates/netcf-0.1.5-1.fc12
netcf-0.1.5-1.fc12 has been pushed to the Fedora 12 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update netcf'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-12472
netcf-0.1.5-1.fc12 has been pushed to the Fedora 12 stable repository. If problems still persist, please make note of it in this bug report.