Hello.<br><br>This is a small program using genl_ctrl_resolve(copied from test-genl.c).<br>Compile: gcc -o test main.c -I libnl-3.2.21/include/ libnl-3.2.21/lib/.libs/libnl-3.a libnl-3.2.21/lib/.libs/libnl-genl-3.a -lpthread -lm<br>
Run memcheck: valgrind --leak-check=full --show-reachable=yes ./test<br><br>I got following output:<br>...<br>==24905== HEAP SUMMARY:<br>==24905==     in use at exit: 112 bytes in 1 blocks<br>==24905==   total heap usage: 148 allocs, 147 frees, 31,720 bytes allocated<br>
==24905== <br>==24905== 112 bytes in 1 blocks are definitely lost in loss record 1 of 1<br>==24905==    at 0x402A5E6: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)<br>==24905==    by 0x804F172: nl_cb_alloc (handlers.c:208)<br>
==24905==    by 0x40A84D2: (below main) (libc-start.c:226)<br>==24905== <br>==24905== LEAK SUMMARY:<br>==24905==    definitely lost: 112 bytes in 1 blocks<br>==24905==    indirectly lost: 0 bytes in 0 blocks<br>==24905==      possibly lost: 0 bytes in 0 blocks<br>
==24905==    still reachable: 0 bytes in 0 blocks<br>==24905==         suppressed: 0 bytes in 0 blocks<br>...<br><br>I think it's a bug in genl_ctrl_probe_by_name(): <br><br>...<br>if (!(cb = nl_cb_clone(nl_socket_get_cb(sk))))<br>
        goto out_msg_free;<br>...<br><br>Here we increase ref count on sk->s_cb, so i think it should be decremented later. <br>With this patch i don't have valgrind memleak anymore:<br><br>--- libnl-3.2.21_o/lib/genl/ctrl.c    2013-01-24 14:30:34.000000000 +0200<br>
+++ libnl-3.2.21/lib/genl/ctrl.c    2013-03-29 16:53:12.012950437 +0200<br>@@ -431,7 +431,8 @@<br>         err = -NLE_OBJ_NOTFOUND;<br>         goto errout;<br>     }<br>-<br>+    <br>+    nl_cb_put( sk->s_cb );<br>     err = genl_family_get_id(family);<br>
     genl_family_put(family);<br> errout:<br><br>I use libnl-3.2.21 with Ubuntu 12.04 (3.2.0-39-generic-pae kernel).<br>Sorry for my English, and please let me know if you need additional information.<br>Thank you.<br><br>