core/dhcp: fix dispose() of NMDHCPClient to handle multiple invocations

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-01-28 22:07:29 +01:00
parent aa1b262091
commit 8eb9cfe0aa

View File

@@ -1565,16 +1565,26 @@ dispose (GObject *object)
* the DHCP client.
*/
if (priv->remove_id)
if (priv->remove_id) {
g_source_remove (priv->remove_id);
priv->remove_id = 0;
}
if (priv->options) {
g_hash_table_destroy (priv->options);
g_free (priv->iface);
if (priv->hwaddr)
g_byte_array_free (priv->hwaddr, TRUE);
priv->options = NULL;
}
g_clear_pointer (&priv->iface, g_free);
if (priv->duid)
if (priv->hwaddr) {
g_byte_array_free (priv->hwaddr, TRUE);
priv->hwaddr = NULL;
}
if (priv->duid) {
g_byte_array_free (priv->duid, TRUE);
priv->duid = NULL;
}
G_OBJECT_CLASS (nm_dhcp_client_parent_class)->dispose (object);
}