Commit fefb965c authored by Thomas Haller's avatar Thomas Haller

libnm: fix leak in nm_client_add_and_activate_connection{2,_async}()

Detected via valgrind:

  $ ./tools/run-nm-test.sh -m -v libnm/tests/test-nm-client -p /libnm/active-connections

Fixes: fbb038af
parent b7d4ad85
Pipeline #20644 passed with stages
in 30 minutes and 38 seconds
......@@ -1168,7 +1168,7 @@ add_activate_cb (GObject *object,
{
gs_unref_object GSimpleAsyncResult *simple = user_data;
gs_unref_variant GVariant *result_data = NULL;
NMActiveConnection *ac;
gs_unref_object NMActiveConnection *ac = NULL;
GError *error = NULL;
ac = nm_manager_add_and_activate_connection_finish (NM_MANAGER (object), result, &result_data, &error);
......
......@@ -918,6 +918,8 @@ activate_info_complete (ActivateInfo *info,
NMActiveConnection *active,
GError *error)
{
nm_assert ((!error) != (!active));
nm_clear_g_signal_handler (info->cancellable, &info->cancelled_id);
c_list_unlink_stale (&info->lst);
......@@ -1118,6 +1120,10 @@ add_activate_cb (GObject *object,
gs_free_error GError *error = NULL;
gboolean success;
nm_assert (info);
nm_assert (!info->active_path);
nm_assert (!info->add_and_activate_output);
if (info->activate_type == ACTIVATE_TYPE_ADD_AND_ACTIVATE_CONNECTION) {
success = nmdbus_manager_call_add_and_activate_connection_finish (NMDBUS_MANAGER (object),
NULL,
......@@ -1209,12 +1215,12 @@ nm_manager_add_and_activate_connection_async (NMManager *manager,
info);
} else {
nmdbus_manager_call_add_and_activate_connection (priv->proxy,
dict,
nm_object_get_path (NM_OBJECT (device)),
specific_object ?: "/",
cancellable,
add_activate_cb,
info);
dict,
nm_object_get_path (NM_OBJECT (device)),
specific_object ?: "/",
cancellable,
add_activate_cb,
info);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment