libnm: fix crash during destruction of NMClient

I am not entirely sure under which circumstances this could have
happened.

From 1.39.10-dev snapshot:

  #0  0x00007fe96825eda4 in _nm_client_notify_event_queue_emit_obj_signal (self=0x0, source=0x0, nmobj=0x7fe950028be0, is_added=0, prio_offset=7, signal_id=3)
      at src/libnm-client-impl/nm-client.c:900
  #1  0x00007fe968258f0e in nml_dbus_property_ao_notify_changed_ao (pr_ao_data=pr_ao_data@entry=0x7fe954032c10, self=self@entry=0x0, is_added=is_added@entry=0)
      at src/libnm-client-impl/nm-client.c:1939
          pr_ao = <optimized out>
          vtable = <optimized out>
  #2  0x00007fe968261d2d in nml_dbus_property_ao_clear (pr_ao=pr_ao@entry=0x7fe95001e560, self=self@entry=0x0) at src/libnm-client-impl/nm-client.c:2314
          pr_ao_data = 0x7fe954032c10
          changed_prop = 0
  #3  0x00007fe968261d6c in nml_dbus_property_ao_clear_many (pr_ao=0x7fe95001e5a8, pr_ao@entry=0x7fe95001e560, len=<optimized out>, len@entry=4, self=self@entry=0x0)
      at src/libnm-client-impl/nm-client.c:2357
  #4  0x00007fe968266d26 in dispose (object=0x7fe95001e3d0) at src/libnm-client-impl/nm-client.c:7958
          self = 0x7fe95001e3d0
          priv = 0x7fe95001e400
  #5  0x00007fe96ae76828 in g_object_unref () at /lib64/libgobject-2.0.so.0
  ...

https://bugzilla.redhat.com/show_bug.cgi?id=2112997

Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
This commit is contained in:
Thomas Haller 2022-08-09 17:26:51 +02:00
parent d8419a9611
commit b1835a45d2
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -7954,8 +7954,8 @@ dispose(GObject *object)
nm_assert(c_list_is_empty(&self->obj_base.queue_notify_lst));
nm_assert(nm_g_hash_table_size(priv->dbus_objects) == 0);
nml_dbus_property_o_clear_many(priv->nm.property_o, G_N_ELEMENTS(priv->nm.property_o), NULL);
nml_dbus_property_ao_clear_many(priv->nm.property_ao, G_N_ELEMENTS(priv->nm.property_ao), NULL);
nml_dbus_property_o_clear_many(priv->nm.property_o, G_N_ELEMENTS(priv->nm.property_o), self);
nml_dbus_property_ao_clear_many(priv->nm.property_ao, G_N_ELEMENTS(priv->nm.property_ao), self);
nm_clear_g_free(&priv->nm.connectivity_check_uri);
nm_clear_g_free(&priv->nm.version);