libnm: use cleanup attribute in NMVpnPluginOld's _connect_generic()

This commit is contained in:
Thomas Haller 2021-05-25 21:53:46 +02:00
parent e56f126071
commit bbe39ed095
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -420,12 +420,12 @@ _connect_generic(NMVpnPluginOld * plugin,
GVariant * properties, GVariant * properties,
GVariant * details) GVariant * details)
{ {
NMVpnPluginOldPrivate *priv = NM_VPN_PLUGIN_OLD_GET_PRIVATE(plugin); NMVpnPluginOldPrivate *priv = NM_VPN_PLUGIN_OLD_GET_PRIVATE(plugin);
NMVpnPluginOldClass * vpn_class = NM_VPN_PLUGIN_OLD_GET_CLASS(plugin); NMVpnPluginOldClass * vpn_class = NM_VPN_PLUGIN_OLD_GET_CLASS(plugin);
gs_unref_object NMConnection *connection = NULL; gs_unref_object NMConnection *connection = NULL;
gboolean success = FALSE; gboolean success = FALSE;
GError * error = NULL; gs_free_error GError *error = NULL;
guint fail_stop_timeout = 0; guint fail_stop_timeout = 0;
if (priv->state != NM_VPN_SERVICE_STATE_STOPPED && priv->state != NM_VPN_SERVICE_STATE_INIT) { if (priv->state != NM_VPN_SERVICE_STATE_STOPPED && priv->state != NM_VPN_SERVICE_STATE_INIT) {
g_dbus_method_invocation_return_error(context, g_dbus_method_invocation_return_error(context,
@ -444,7 +444,6 @@ _connect_generic(NMVpnPluginOld * plugin,
NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS, NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
"Invalid connection: %s", "Invalid connection: %s",
error->message); error->message);
g_clear_error(&error);
return; return;
} }
@ -479,7 +478,7 @@ _connect_generic(NMVpnPluginOld * plugin,
/* Add a timer to make sure we do not wait indefinitely for the successful connect. */ /* Add a timer to make sure we do not wait indefinitely for the successful connect. */
connect_timer_start(plugin); connect_timer_start(plugin);
} else { } else {
g_dbus_method_invocation_take_error(context, error); g_dbus_method_invocation_take_error(context, g_steal_pointer(&error));
/* Stop the plugin from an idle handler so that the Connect /* Stop the plugin from an idle handler so that the Connect
* method return gets sent before the STOP StateChanged signal. * method return gets sent before the STOP StateChanged signal.