mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 23:30:18 +01:00
libnm/tests: fix memleaks in test code for valgrind
(cherry picked from commit 76745817c3)
This commit is contained in:
parent
b9a8f3c059
commit
26f96871a1
3 changed files with 13 additions and 9 deletions
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "nm-remote-settings.h"
|
||||
#include "common.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
|
||||
static NMTestServiceInfo *sinfo;
|
||||
static NMRemoteSettings *settings = NULL;
|
||||
|
|
@ -63,7 +64,7 @@ add_cb (NMRemoteSettings *s,
|
|||
static void
|
||||
test_add_connection (void)
|
||||
{
|
||||
NMConnection *connection;
|
||||
gs_unref_object NMConnection *connection = NULL;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingWired *s_wired;
|
||||
char *uuid;
|
||||
|
|
@ -256,6 +257,7 @@ test_make_visible (void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
g_slist_free (list);
|
||||
g_assert (found == TRUE);
|
||||
|
||||
g_free (path);
|
||||
|
|
@ -298,6 +300,7 @@ test_remove_connection (void)
|
|||
g_assert_cmpint (g_slist_length (list), >, 0);
|
||||
|
||||
connection = NM_REMOTE_CONNECTION (list->data);
|
||||
g_slist_free (list);
|
||||
g_assert (connection);
|
||||
g_assert (remote == connection);
|
||||
path = g_strdup (nm_connection_get_path (NM_CONNECTION (connection)));
|
||||
|
|
@ -329,6 +332,7 @@ test_remove_connection (void)
|
|||
g_assert ((gpointer) connection != (gpointer) candidate);
|
||||
g_assert_cmpstr (path, ==, nm_connection_get_path (candidate));
|
||||
}
|
||||
g_slist_free (list);
|
||||
|
||||
g_free (path);
|
||||
g_object_unref (proxy);
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ add_remove_cb (GObject *s,
|
|||
{
|
||||
NMRemoteConnection *connection;
|
||||
gboolean *done = user_data;
|
||||
GError *error = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
connection = nm_client_add_connection_finish (client, result, &error);
|
||||
g_assert_error (error, NM_CLIENT_ERROR, NM_CLIENT_ERROR_OBJECT_CREATION_FAILED);
|
||||
|
|
@ -426,7 +426,7 @@ add_bad_cb (GObject *s,
|
|||
gpointer user_data)
|
||||
{
|
||||
gboolean *done = user_data;
|
||||
GError *error = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
remote = nm_client_add_connection_finish (client, result, &error);
|
||||
g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY);
|
||||
|
|
@ -469,7 +469,7 @@ save_hostname_cb (GObject *s,
|
|||
gpointer user_data)
|
||||
{
|
||||
gboolean *done = user_data;
|
||||
GError *error = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
nm_client_save_hostname_finish (client, result, &error);
|
||||
g_assert_no_error (error);
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ connection_activated_none_cb (GObject *c,
|
|||
{
|
||||
TestSecretAgentData *sadata = user_data;
|
||||
NMActiveConnection *ac;
|
||||
GError *error = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
||||
g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
|
||||
|
|
@ -399,8 +399,8 @@ connection_activated_no_secrets_cb (GObject *c,
|
|||
gpointer user_data)
|
||||
{
|
||||
TestSecretAgentData *sadata = user_data;
|
||||
NMActiveConnection *ac;
|
||||
GError *error = NULL;
|
||||
gs_unref_object NMActiveConnection *ac = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
||||
g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
|
||||
|
|
@ -434,8 +434,8 @@ connection_activated_cancel_cb (GObject *c,
|
|||
gpointer user_data)
|
||||
{
|
||||
TestSecretAgentData *sadata = user_data;
|
||||
NMActiveConnection *ac;
|
||||
GError *error = NULL;
|
||||
gs_unref_object NMActiveConnection *ac;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
||||
g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_USER_CANCELED);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue