From 202b693bd8a390b072c25bfaf4d5cd369e427083 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 14 Jun 2012 18:05:16 -0500 Subject: [PATCH] libnm-glib: don't try to free unset GValues when disconnecting VPNs IPv6-capable plugins will fill these in, but old IPv4-only won't, so don't try to free the GValues when they aren't set. --- libnm-glib/nm-vpn-plugin.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index c95b40217c..dd4d7b3a61 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -754,10 +754,14 @@ finalize (GObject *object) nm_vpn_plugin_set_connection (plugin, NULL); g_free (priv->dbus_service_name); - g_value_unset (&priv->banner); - g_value_unset (&priv->tundev); - g_value_unset (&priv->gateway); - g_value_unset (&priv->mtu); + if (G_IS_VALUE (&priv->banner)) + g_value_unset (&priv->banner); + if (G_IS_VALUE (&priv->tundev)) + g_value_unset (&priv->tundev); + if (G_IS_VALUE (&priv->gateway)) + g_value_unset (&priv->gateway); + if (G_IS_VALUE (&priv->mtu)) + g_value_unset (&priv->mtu); G_OBJECT_CLASS (nm_vpn_plugin_parent_class)->finalize (object); }