core: ensure dhcp_manager exists before trying to unref it (bgo #626610)

If a new device wasn't supported, it gets destroyed by the
NMDevice constructor() method.  But in the constructor paths
the DHCP manager isn't created yet, and so we attempt to unref
a non-existent DHCP manager.  Usually just a harmless warning,
but apparently a crash sometimes.
This commit is contained in:
Dan Williams 2010-08-11 13:09:33 -05:00
parent a4e6519d11
commit 96a9ce41fb

View file

@ -3375,7 +3375,8 @@ finalize (GObject *object)
NMDevice *self = NM_DEVICE (object);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
g_object_unref (priv->dhcp_manager);
if (priv->dhcp_manager)
g_object_unref (priv->dhcp_manager);
g_free (priv->udi);
g_free (priv->iface);