core/tests: fix memleak in tests to avoid valgrind warnings

(cherry picked from commit 1680bf3ad1)
This commit is contained in:
Thomas Haller 2015-02-04 12:13:14 +01:00
parent 84ff53ec76
commit b352d0a26b

View file

@ -26,6 +26,7 @@
#include <nm-simple-connection.h>
#include <nm-setting-connection.h>
#include "nm-device-ethernet-utils.h"
#include "gsystem-local-alloc.h"
static NMConnection *
_new_connection (const char *id)
@ -45,7 +46,7 @@ _new_connection (const char *id)
static void
test_defname_no_connections (void)
{
char *name;
gs_free char *name;
name = nm_device_ethernet_utils_get_default_wired_name (NULL);
g_assert_cmpstr (name, ==, "Wired connection 1");
@ -57,7 +58,7 @@ static void
test_defname_no_conflict (void)
{
GSList *list = NULL;
char *name;
gs_free char *name;
list = g_slist_append (list, _new_connection ("asdfasdfasdfadf"));
list = g_slist_append (list, _new_connection ("work wifi"));
@ -75,7 +76,7 @@ static void
test_defname_conflict (void)
{
GSList *list = NULL;
char *name;
gs_free char *name;
list = g_slist_append (list, _new_connection ("asdfasdfasdfadf"));
list = g_slist_append (list, _new_connection ("Wired connection 1"));
@ -93,7 +94,7 @@ static void
test_defname_multiple_conflicts (void)
{
GSList *list = NULL;
char *name;
gs_free char *name;
list = g_slist_append (list, _new_connection ("random gsm connection"));
list = g_slist_append (list, _new_connection ("home wifi"));