From b352d0a26b91b487aabf65c349309b7ab67780bb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 4 Feb 2015 12:13:14 +0100 Subject: [PATCH] core/tests: fix memleak in tests to avoid valgrind warnings (cherry picked from commit 1680bf3ad1e36c3a6993b2e6ada20363c4195dce) --- src/tests/test-wired-defname.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tests/test-wired-defname.c b/src/tests/test-wired-defname.c index a05588b8a4..1d83f3d1aa 100644 --- a/src/tests/test-wired-defname.c +++ b/src/tests/test-wired-defname.c @@ -26,6 +26,7 @@ #include #include #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"));