ndp: memleak: unregister router advertisement handler on dispose

ndp_close() does not do that -- it only closes the socket. It's safe to call
even if we didn't start solicitation as it has a NULL-check.

==7745== 80 (+80) bytes in 2 (+2) blocks are definitely lost in loss record 3,983 of 5,735
==7745==    at 0x4C29BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==7745==    by 0x6F57A2D: ndp_msgrcv_handler_register (libndp.c:1697)
==7745==    by 0x47572E: start (nm-lndp-rdisc.c:691)
==7745==    by 0x44A457: addrconf6_start_with_link_ready (nm-device.c:4280)
==7745==    by 0x44C1E7: linklocal6_complete (nm-device.c:3931)
==7745==    by 0x44C1E7: update_ip_config (nm-device.c:6667)
==7745==    by 0x44C2F8: queued_ip_config_change (nm-device.c:6688)
==7745==    by 0x7F44AEA: g_main_dispatch (gmain.c:3111)
==7745==    by 0x7F44AEA: g_main_context_dispatch (gmain.c:3710)
==7745==    by 0x7F44E87: g_main_context_iterate.isra.29 (gmain.c:3781)
==7745==    by 0x7F451B1: g_main_loop_run (gmain.c:3975)
==7745==    by 0x432F74: main (main.c:460)

(cherry picked from commit 5d9f9febfb)
This commit is contained in:
Lubomir Rintel 2015-02-18 13:20:59 +01:00
parent 098c2f2294
commit 50348b708a

View file

@ -720,6 +720,7 @@ dispose (GObject *object)
g_clear_pointer (&priv->event_channel, g_io_channel_unref);
if (priv->ndp) {
ndp_msgrcv_handler_unregister (priv->ndp, receive_ra, NDP_MSG_RA, NM_RDISC (rdisc)->ifindex, rdisc);
ndp_close (priv->ndp);
priv->ndp = NULL;
}