summaryrefslogtreecommitdiff
path: root/libnm
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-01-15 15:17:38 +0100
committerThomas Haller <thaller@redhat.com>2018-01-16 14:38:06 +0100
commite89e5edcf80906a45b63793ed3fe262e41c07a75 (patch)
tree3074741b8c8f28a24fedc3e398fd00ae2a2573b4 /libnm
parent8ba46ff4c6248507e4e0f3dbcdcfb6686e3a45be (diff)
downloadNetworkManager-e89e5edcf80906a45b63793ed3fe262e41c07a75.tar.gz
libnm: cleanup resource handling in NMVpnServicePlugin:init_sync()
Diffstat (limited to 'libnm')
-rw-r--r--libnm/nm-vpn-service-plugin.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c
index 946ac39766..d36fb43bfb 100644
--- a/libnm/nm-vpn-service-plugin.c
+++ b/libnm/nm-vpn-service-plugin.c
@@ -945,10 +945,9 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
{
NMVpnServicePlugin *plugin = NM_VPN_SERVICE_PLUGIN (initable);
NMVpnServicePluginPrivate *priv = NM_VPN_SERVICE_PLUGIN_GET_PRIVATE (plugin);
- GDBusConnection *connection = NULL;
- GDBusProxy *proxy;
+ gs_unref_object GDBusConnection *connection = NULL;
+ gs_unref_object GDBusProxy *proxy = NULL;
GVariant *ret;
- gboolean success = FALSE;
if (!priv->dbus_service_name) {
g_set_error_literal (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
@@ -969,7 +968,7 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
DBUS_INTERFACE_DBUS,
cancellable, error);
if (!proxy)
- goto out;
+ return FALSE;
priv->dbus_vpn_service_plugin = nmdbus_vpn_plugin_skeleton_new ();
@@ -990,7 +989,7 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
connection,
NM_VPN_DBUS_PLUGIN_PATH,
error))
- goto out;
+ return FALSE;
nm_vpn_service_plugin_set_connection (plugin, connection);
nm_vpn_service_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_INIT);
@@ -1000,20 +999,14 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
g_variant_new ("(su)", priv->dbus_service_name, 0),
G_DBUS_CALL_FLAGS_NONE, -1,
cancellable, error);
- g_object_unref (proxy);
if (!ret) {
if (error && *error)
g_dbus_error_strip_remote_error (*error);
- goto out;
+ return FALSE;
}
g_variant_unref (ret);
- success = TRUE;
-
- out:
- g_clear_object (&connection);
-
- return success;
+ return TRUE;
}
static void