manager: fix leaking volatile-connection-list on exit

On exit during NMManager's dispose(), we must fist remove active connections
via active_connection_remove(), before clearing the volatile-connection-list.
Otheriwise, while deleting the active connection, we schedule a idle action
to delete the volatile connection on idle, but at that point the dispose()
already cleaned up the idle list.

  ==3150== 72 (24 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 3,411 of 6,079
  ==3150==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
  ==3150==    by 0x6AB7358: g_malloc (gmem.c:94)
  ==3150==    by 0x6ACEF35: g_slice_alloc (gslice.c:1025)
  ==3150==    by 0x1686B1: connection_flags_changed (nm-manager.c:1823)
  ==3150==    by 0x661F73C: g_closure_invoke (gclosure.c:804)
  ==3150==    by 0x66324DD: signal_emit_unlocked_R (gsignal.c:3635)
  ==3150==    by 0x663AD04: g_signal_emit_valist (gsignal.c:3391)
  ==3150==    by 0x663B66E: g_signal_emit (gsignal.c:3447)
  ==3150==    by 0x2EC753: connection_flags_changed (nm-settings.c:824)
  ==3150==    by 0x661F73C: g_closure_invoke (gclosure.c:804)
  ==3150==    by 0x66324DD: signal_emit_unlocked_R (gsignal.c:3635)
  ==3150==    by 0x663AD04: g_signal_emit_valist (gsignal.c:3391)
  ==3150==    by 0x663B66E: g_signal_emit (gsignal.c:3447)
  ==3150==    by 0x6623C03: g_object_dispatch_properties_changed (gobject.c:1080)
  ==3150==    by 0x1DFD47: dispatch_properties_changed (nm-dbus-object.c:237)
  ==3150==    by 0x6626178: g_object_notify_by_spec_internal (gobject.c:1173)
  ==3150==    by 0x6626178: g_object_notify_by_pspec (gobject.c:1283)
  ==3150==    by 0x2E7377: _notify (nm-settings-connection.c:53)
  ==3150==    by 0x2E7377: nm_settings_connection_set_flags_full (nm-settings-connection.c:2346)
  ==3150==    by 0x2E744D: nm_settings_connection_set_flags (nm-settings-connection.c:2316)
  ==3150==    by 0x2E7466: set_visible (nm-settings-connection.c:316)
  ==3150==    by 0x2E7774: nm_settings_connection_delete (nm-settings-connection.c:795)
  ==3150==    by 0x1665A8: _delete_volatile_connection_do (nm-manager.c:598)
  ==3150==    by 0x1668F4: active_connection_remove (nm-manager.c:625)
  ==3150==    by 0x16ABA7: dispose (nm-manager.c:6726)
  ==3150==    by 0x6624607: g_object_unref (gobject.c:3293)
  ==3150==    by 0x1D779B: _nm_singleton_instance_destroy (nm-core-utils.c:138)
  ==3150==    by 0x4011332: _dl_fini (in /usr/lib64/ld-2.26.so)
  ==3150==    by 0x815FB57: __run_exit_handlers (in /usr/lib64/libc-2.26.so)
  ==3150==    by 0x815FBA9: exit (in /usr/lib64/libc-2.26.so)
  ==3150==    by 0x1383C7: main (main.c:467)
This commit is contained in:
Thomas Haller 2018-03-10 16:18:16 +01:00
parent 6a54f4279f
commit 0b756184eb

View file

@ -6760,11 +6760,6 @@ dispose (GObject *object)
CList *iter, *iter_safe;
NMActiveConnection *ac, *ac_safe;
nm_clear_g_source (&priv->delete_volatile_connection_idle_id);
_delete_volatile_connection_all (self, FALSE);
nm_assert (!priv->delete_volatile_connection_idle_id);
nm_assert (c_list_is_empty (&priv->delete_volatile_connection_lst_head));
g_signal_handlers_disconnect_by_func (priv->platform,
G_CALLBACK (platform_link_cb),
self);
@ -6859,6 +6854,11 @@ dispose (GObject *object)
g_clear_object (&priv->rfkill_mgr);
}
nm_clear_g_source (&priv->delete_volatile_connection_idle_id);
_delete_volatile_connection_all (self, FALSE);
nm_assert (!priv->delete_volatile_connection_idle_id);
nm_assert (c_list_is_empty (&priv->delete_volatile_connection_lst_head));
nm_device_factory_manager_for_each_factory (_deinit_device_factory, self);
nm_clear_g_source (&priv->timestamp_update_id);