NetworkManager/clients/cli
Beniamino Galvani 100ed67a27 cli: unref main loop after destroying NMClient instance
Callbacks might reference the main loop when destroying the NMClient
instance. Unref the main loop later.

  # G_DEBUG=fatal-warnings valgrind --num-callers=100 nmcli device wifi connect home
  ^C
  Error: nmcli terminated by signal Interrupt (2)
  Error: Connection activation failed: (0) No reason given.
  ==11050== Invalid read of size 4
  ==11050==    at 0x4C90D3D: g_main_loop_quit (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x431435: quit (devices.c:934)
  ==11050==    by 0x43272C: connected_state_cb (devices.c:1919)
  ==11050==    by 0x4BF6741: g_closure_invoke (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4C0A603: ??? (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4C133AD: g_signal_emit_valist (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4C139D2: g_signal_emit (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4BFB1C3: ??? (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4BFAAEC: ??? (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x4BFD86A: g_object_thaw_notify (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x48BA040: _nm_client_notify_event_emit (nm-client.c:937)
  ==11050==    by 0x48CA01F: _dbus_handle_changes_commit (nm-client.c:2850)
  ==11050==    by 0x48CC221: _dbus_handle_changes (nm-client.c:2864)
  ==11050==    by 0x48CC833: _init_release_all (nm-client.c:6969)
  ==11050==    by 0x48D2818: dispose (nm-client.c:7826)
  ==11050==    by 0x4BFBC27: g_object_unref (in /usr/lib64/libgobject-2.0.so.0.6200.6)
  ==11050==    by 0x43FF93: nmc_cleanup (nmcli.c:941)
  ==11050==    by 0x4410AD: main (nmcli.c:1005)
  ==11050==  Address 0x54738fc is 12 bytes inside a block of size 16 free'd
  ==11050==    at 0x4839A0C: free (vg_replace_malloc.c:540)
  ==11050==    by 0x4C9649C: g_free (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x4410A3: main (nmcli.c:1004)
  ==11050==  Block was alloc'd at
  ==11050==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
  ==11050==    by 0x4C96400: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x4C90A45: g_main_loop_new (in /usr/lib64/libglib-2.0.so.0.6200.6)
  ==11050==    by 0x441020: main (nmcli.c:987)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/501
(cherry picked from commit 211c6fa795)
(cherry picked from commit f8452b48e9)
2020-05-12 23:05:46 +02:00
..
agent.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
agent.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
common.c libnm,client: use nm_g_task_new() to set source-tag and check it 2019-10-16 08:56:00 +02:00
common.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
connections.c nmcli: remove interface length check in nmcli 2020-02-17 17:25:52 +01:00
connections.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
devices.c cli: expose device D-Bus path 2019-12-10 17:58:56 +01:00
devices.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
general.c cli: unsubscribe permission signal from NMClient on exit 2019-11-07 11:34:36 +01:00
general.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
meson.build meson: Improve nmcli build 2019-10-01 09:49:33 +02:00
nmcli-completion cli: make nmcli do its own command completion 2017-02-13 16:32:15 +01:00
nmcli.c cli: unref main loop after destroying NMClient instance 2020-05-12 23:05:46 +02:00
nmcli.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
polkit-agent.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
polkit-agent.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
settings.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
settings.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
utils.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
utils.h cli: expose device D-Bus path 2019-12-10 17:58:56 +01:00