mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 03:40:07 +01:00
core: fix leaking connection in impl_settings_add_connection_helper()
Fixes: 0f6baeef35
This commit is contained in:
parent
19a78f8954
commit
608dfacb0b
1 changed files with 10 additions and 15 deletions
|
|
@ -1337,7 +1337,7 @@ impl_settings_add_connection_helper (NMSettings *self,
|
|||
GVariant *settings,
|
||||
gboolean save_to_disk)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gs_unref_object NMConnection *connection = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
connection = _nm_simple_connection_new_from_dbus (settings,
|
||||
|
|
@ -1345,23 +1345,18 @@ impl_settings_add_connection_helper (NMSettings *self,
|
|||
| NM_SETTING_PARSE_FLAGS_NORMALIZE,
|
||||
&error);
|
||||
|
||||
if (connection) {
|
||||
if (!nm_connection_verify_secrets (connection, &error))
|
||||
goto failure;
|
||||
|
||||
nm_settings_add_connection_dbus (self,
|
||||
connection,
|
||||
save_to_disk,
|
||||
context,
|
||||
impl_settings_add_connection_add_cb,
|
||||
NULL);
|
||||
g_object_unref (connection);
|
||||
if ( !connection
|
||||
|| !nm_connection_verify_secrets (connection, &error)) {
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
return;
|
||||
}
|
||||
|
||||
failure:
|
||||
g_assert (error);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
nm_settings_add_connection_dbus (self,
|
||||
connection,
|
||||
save_to_disk,
|
||||
context,
|
||||
impl_settings_add_connection_add_cb,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue