test: initialize auto-destructed pointers

Otherwise the compiler complains that they could be left uninitialized in case
the function returns too early.

Fixes: 76745817c3
This commit is contained in:
Lubomir Rintel
2015-02-09 15:17:53 +01:00
parent b0b15e4718
commit 2981839bde
9 changed files with 39 additions and 39 deletions

View File

@@ -111,7 +111,7 @@ test_wifi_open (void)
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingIPConfig *s_ip4;
gs_unref_object NMSupplicantConfig *config;
gs_unref_object NMSupplicantConfig *config = NULL;
GHashTable *hash;
char *uuid;
gboolean success;
@@ -207,7 +207,7 @@ test_wifi_wep_key (const char *detail,
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
NMSettingIPConfig *s_ip4;
gs_unref_object NMSupplicantConfig *config;
gs_unref_object NMSupplicantConfig *config = NULL;
GHashTable *hash;
char *uuid;
gboolean success;
@@ -345,7 +345,7 @@ test_wifi_wpa_psk (const char *detail,
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
NMSettingIPConfig *s_ip4;
gs_unref_object NMSupplicantConfig *config;
gs_unref_object NMSupplicantConfig *config = NULL;
GHashTable *hash;
char *uuid;
gboolean success;

View File

@@ -46,7 +46,7 @@ _new_connection (const char *id)
static void
test_defname_no_connections (void)
{
gs_free char *name;
gs_free char *name = NULL;
name = nm_device_ethernet_utils_get_default_wired_name (NULL);
g_assert_cmpstr (name, ==, "Wired connection 1");
@@ -58,7 +58,7 @@ static void
test_defname_no_conflict (void)
{
GSList *list = NULL;
gs_free char *name;
gs_free char *name = NULL;
list = g_slist_append (list, _new_connection ("asdfasdfasdfadf"));
list = g_slist_append (list, _new_connection ("work wifi"));
@@ -76,7 +76,7 @@ static void
test_defname_conflict (void)
{
GSList *list = NULL;
gs_free char *name;
gs_free char *name = NULL;
list = g_slist_append (list, _new_connection ("asdfasdfasdfadf"));
list = g_slist_append (list, _new_connection ("Wired connection 1"));
@@ -94,7 +94,7 @@ static void
test_defname_multiple_conflicts (void)
{
GSList *list = NULL;
gs_free char *name;
gs_free char *name = NULL;
list = g_slist_append (list, _new_connection ("random gsm connection"));
list = g_slist_append (list, _new_connection ("home wifi"));