mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-09 19:00:31 +01:00
libnm: fix error handling in NMVpnPluginOld's _connect_generic()
Also Coverity found that something is wrong here:
Error: FORWARD_NULL (CWE-476): [#def361]
NetworkManager-1.31.5/src/libnm-client-impl/nm-vpn-plugin-old.c:441: var_compare_op: Comparing "connection" to null implies that "connection" might be null.
NetworkManager-1.31.5/src/libnm-client-impl/nm-vpn-plugin-old.c:489: var_deref_model: Passing null pointer "connection" to "g_object_unref", which dereferences it.
# 487| }
# 488|
# 489|-> g_object_unref(connection);
# 490| }
# 491|
Fixes: 6793a32a8c ('libnm: port to GDBus')
This commit is contained in:
parent
8db23d47e4
commit
e56f126071
1 changed files with 7 additions and 8 deletions
|
|
@ -420,12 +420,12 @@ _connect_generic(NMVpnPluginOld * plugin,
|
|||
GVariant * properties,
|
||||
GVariant * details)
|
||||
{
|
||||
NMVpnPluginOldPrivate *priv = NM_VPN_PLUGIN_OLD_GET_PRIVATE(plugin);
|
||||
NMVpnPluginOldClass * vpn_class = NM_VPN_PLUGIN_OLD_GET_CLASS(plugin);
|
||||
NMConnection * connection;
|
||||
gboolean success = FALSE;
|
||||
GError * error = NULL;
|
||||
guint fail_stop_timeout = 0;
|
||||
NMVpnPluginOldPrivate *priv = NM_VPN_PLUGIN_OLD_GET_PRIVATE(plugin);
|
||||
NMVpnPluginOldClass * vpn_class = NM_VPN_PLUGIN_OLD_GET_CLASS(plugin);
|
||||
gs_unref_object NMConnection *connection = NULL;
|
||||
gboolean success = FALSE;
|
||||
GError * error = NULL;
|
||||
guint fail_stop_timeout = 0;
|
||||
|
||||
if (priv->state != NM_VPN_SERVICE_STATE_STOPPED && priv->state != NM_VPN_SERVICE_STATE_INIT) {
|
||||
g_dbus_method_invocation_return_error(context,
|
||||
|
|
@ -445,6 +445,7 @@ _connect_generic(NMVpnPluginOld * plugin,
|
|||
"Invalid connection: %s",
|
||||
error->message);
|
||||
g_clear_error(&error);
|
||||
return;
|
||||
}
|
||||
|
||||
priv->interactive = FALSE;
|
||||
|
|
@ -485,8 +486,6 @@ _connect_generic(NMVpnPluginOld * plugin,
|
|||
*/
|
||||
schedule_fail_stop(plugin, fail_stop_timeout);
|
||||
}
|
||||
|
||||
g_object_unref(connection);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue