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:
@@ -98,7 +98,7 @@ out:
|
|||||||
static void
|
static void
|
||||||
test_cert (gconstpointer test_data)
|
test_cert (gconstpointer test_data)
|
||||||
{
|
{
|
||||||
gs_free char *path;
|
gs_free char *path = NULL;
|
||||||
GByteArray *array;
|
GByteArray *array;
|
||||||
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
@@ -649,7 +649,7 @@ test_setting_ip4_config_address_data (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_apn_spaces (void)
|
test_setting_gsm_apn_spaces (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||||
@@ -677,7 +677,7 @@ test_setting_gsm_apn_spaces (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_apn_bad_chars (void)
|
test_setting_gsm_apn_bad_chars (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
|
|
||||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||||
ASSERT (s_gsm != NULL,
|
ASSERT (s_gsm != NULL,
|
||||||
@@ -715,7 +715,7 @@ test_setting_gsm_apn_bad_chars (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_apn_underscore (void)
|
test_setting_gsm_apn_underscore (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
|
|
||||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||||
g_assert (s_gsm);
|
g_assert (s_gsm);
|
||||||
@@ -730,7 +730,7 @@ test_setting_gsm_apn_underscore (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_without_number (void)
|
test_setting_gsm_without_number (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
|
|
||||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||||
g_assert (s_gsm);
|
g_assert (s_gsm);
|
||||||
@@ -2390,7 +2390,7 @@ test_connection_bad_base_types (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_compare_id (void)
|
test_setting_compare_id (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSetting *old, *new;
|
gs_unref_object NMSetting *old = NULL, *new = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
old = nm_setting_connection_new ();
|
old = nm_setting_connection_new ();
|
||||||
@@ -2414,7 +2414,7 @@ test_setting_compare_id (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_compare_timestamp (void)
|
test_setting_compare_timestamp (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSetting *old, *new;
|
gs_unref_object NMSetting *old = NULL, *new = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
old = nm_setting_connection_new ();
|
old = nm_setting_connection_new ();
|
||||||
@@ -2459,7 +2459,7 @@ static void
|
|||||||
test_setting_compare_secrets (gconstpointer test_data)
|
test_setting_compare_secrets (gconstpointer test_data)
|
||||||
{
|
{
|
||||||
const TestDataCompareSecrets *data = test_data;
|
const TestDataCompareSecrets *data = test_data;
|
||||||
gs_unref_object NMSetting *old, *new;
|
gs_unref_object NMSetting *old = NULL, *new = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
/* Make sure that a connection with transient/unsaved secrets compares
|
/* Make sure that a connection with transient/unsaved secrets compares
|
||||||
@@ -2490,7 +2490,7 @@ static void
|
|||||||
test_setting_compare_vpn_secrets (gconstpointer test_data)
|
test_setting_compare_vpn_secrets (gconstpointer test_data)
|
||||||
{
|
{
|
||||||
const TestDataCompareSecrets *data = test_data;
|
const TestDataCompareSecrets *data = test_data;
|
||||||
gs_unref_object NMSetting *old, *new;
|
gs_unref_object NMSetting *old = NULL, *new = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
/* Make sure that a connection with transient/unsaved secrets compares
|
/* Make sure that a connection with transient/unsaved secrets compares
|
||||||
@@ -2766,7 +2766,7 @@ test_setting_connection_changed_signal (void)
|
|||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
gs_free char *uuid;
|
gs_free char *uuid = NULL;
|
||||||
|
|
||||||
connection = nm_simple_connection_new ();
|
connection = nm_simple_connection_new ();
|
||||||
g_signal_connect (connection,
|
g_signal_connect (connection,
|
||||||
@@ -3172,7 +3172,7 @@ test_setting_802_1x_changed_signal (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_old_uuid (void)
|
test_setting_old_uuid (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSetting *setting;
|
gs_unref_object NMSetting *setting = NULL;
|
||||||
|
|
||||||
/* NetworkManager-0.9.4.0 generated 40-character UUIDs with no dashes,
|
/* NetworkManager-0.9.4.0 generated 40-character UUIDs with no dashes,
|
||||||
* like this one. Test that we maintain compatibility. */
|
* like this one. Test that we maintain compatibility. */
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
static void
|
static void
|
||||||
test_dcb_flags_valid (void)
|
test_dcb_flags_valid (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
guint i;
|
guint i;
|
||||||
@@ -90,7 +90,7 @@ test_dcb_flags_valid (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_flags_invalid (void)
|
test_dcb_flags_invalid (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ test_dcb_flags_invalid (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_app_priorities (void)
|
test_dcb_app_priorities (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ test_dcb_app_priorities (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_priorities_valid (void)
|
test_dcb_priorities_valid (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
guint i;
|
guint i;
|
||||||
@@ -270,7 +270,7 @@ test_dcb_priorities_valid (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_bandwidth_sums (void)
|
test_dcb_bandwidth_sums (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
|
@@ -96,7 +96,7 @@ out:
|
|||||||
static void
|
static void
|
||||||
test_cert (gconstpointer test_data)
|
test_cert (gconstpointer test_data)
|
||||||
{
|
{
|
||||||
gs_free char *path;
|
gs_free char *path = NULL;
|
||||||
GByteArray *array;
|
GByteArray *array;
|
||||||
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
@@ -415,7 +415,7 @@ test_setting_ip6_config_old_address_array (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_apn_spaces (void)
|
test_setting_gsm_apn_spaces (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||||
@@ -443,7 +443,7 @@ test_setting_gsm_apn_spaces (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_apn_bad_chars (void)
|
test_setting_gsm_apn_bad_chars (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
|
|
||||||
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
s_gsm = (NMSettingGsm *) nm_setting_gsm_new ();
|
||||||
ASSERT (s_gsm != NULL,
|
ASSERT (s_gsm != NULL,
|
||||||
@@ -481,7 +481,7 @@ test_setting_gsm_apn_bad_chars (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_apn_underscore (void)
|
test_setting_gsm_apn_underscore (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ test_setting_gsm_apn_underscore (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_gsm_without_number (void)
|
test_setting_gsm_without_number (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingGsm *s_gsm;
|
gs_unref_object NMSettingGsm *s_gsm = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
@@ -1681,7 +1681,7 @@ test_connection_bad_base_types (void)
|
|||||||
static void
|
static void
|
||||||
test_setting_compare_id (void)
|
test_setting_compare_id (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSetting *old, *new;
|
gs_unref_object NMSetting *old = NULL, *new = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
old = nm_setting_connection_new ();
|
old = nm_setting_connection_new ();
|
||||||
@@ -1707,7 +1707,7 @@ test_setting_compare_secrets (NMSettingSecretFlags secret_flags,
|
|||||||
NMSettingCompareFlags comp_flags,
|
NMSettingCompareFlags comp_flags,
|
||||||
gboolean remove_secret)
|
gboolean remove_secret)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSetting *old, *new;
|
gs_unref_object NMSetting *old = NULL, *new = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
/* Make sure that a connection with transient/unsaved secrets compares
|
/* Make sure that a connection with transient/unsaved secrets compares
|
||||||
@@ -1739,7 +1739,7 @@ test_setting_compare_vpn_secrets (NMSettingSecretFlags secret_flags,
|
|||||||
NMSettingCompareFlags comp_flags,
|
NMSettingCompareFlags comp_flags,
|
||||||
gboolean remove_secret)
|
gboolean remove_secret)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSetting *old, *new;
|
gs_unref_object NMSetting *old = NULL, *new = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
/* Make sure that a connection with transient/unsaved secrets compares
|
/* Make sure that a connection with transient/unsaved secrets compares
|
||||||
@@ -1918,7 +1918,7 @@ test_setting_connection_changed_signal (void)
|
|||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
gs_free char *uuid;
|
gs_free char *uuid = NULL;
|
||||||
|
|
||||||
connection = nm_connection_new ();
|
connection = nm_connection_new ();
|
||||||
g_signal_connect (connection,
|
g_signal_connect (connection,
|
||||||
@@ -2328,7 +2328,7 @@ static void
|
|||||||
test_setting_old_uuid (void)
|
test_setting_old_uuid (void)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gs_unref_object NMSetting *setting;
|
gs_unref_object NMSetting *setting = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
/* NetworkManager-0.9.4.0 generated 40-character UUIDs with no dashes,
|
/* NetworkManager-0.9.4.0 generated 40-character UUIDs with no dashes,
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
static void
|
static void
|
||||||
test_dcb_flags_valid (void)
|
test_dcb_flags_valid (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
guint i;
|
guint i;
|
||||||
@@ -88,7 +88,7 @@ test_dcb_flags_valid (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_flags_invalid (void)
|
test_dcb_flags_invalid (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ test_dcb_flags_invalid (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_app_priorities (void)
|
test_dcb_app_priorities (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ test_dcb_app_priorities (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_priorities_valid (void)
|
test_dcb_priorities_valid (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
guint i;
|
guint i;
|
||||||
@@ -268,7 +268,7 @@ test_dcb_priorities_valid (void)
|
|||||||
static void
|
static void
|
||||||
test_dcb_bandwidth_sums (void)
|
test_dcb_bandwidth_sums (void)
|
||||||
{
|
{
|
||||||
gs_unref_object NMSettingDcb *s_dcb;
|
gs_unref_object NMSettingDcb *s_dcb = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
|
@@ -434,7 +434,7 @@ connection_activated_cancel_cb (GObject *c,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
TestSecretAgentData *sadata = user_data;
|
TestSecretAgentData *sadata = user_data;
|
||||||
gs_unref_object NMActiveConnection *ac;
|
gs_unref_object NMActiveConnection *ac = NULL;
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
|
|
||||||
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
ac = nm_client_activate_connection_finish (sadata->client, result, &error);
|
||||||
|
@@ -111,7 +111,7 @@ test_wifi_open (void)
|
|||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingWireless *s_wifi;
|
NMSettingWireless *s_wifi;
|
||||||
NMSettingIPConfig *s_ip4;
|
NMSettingIPConfig *s_ip4;
|
||||||
gs_unref_object NMSupplicantConfig *config;
|
gs_unref_object NMSupplicantConfig *config = NULL;
|
||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
char *uuid;
|
char *uuid;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
@@ -207,7 +207,7 @@ test_wifi_wep_key (const char *detail,
|
|||||||
NMSettingWireless *s_wifi;
|
NMSettingWireless *s_wifi;
|
||||||
NMSettingWirelessSecurity *s_wsec;
|
NMSettingWirelessSecurity *s_wsec;
|
||||||
NMSettingIPConfig *s_ip4;
|
NMSettingIPConfig *s_ip4;
|
||||||
gs_unref_object NMSupplicantConfig *config;
|
gs_unref_object NMSupplicantConfig *config = NULL;
|
||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
char *uuid;
|
char *uuid;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
@@ -345,7 +345,7 @@ test_wifi_wpa_psk (const char *detail,
|
|||||||
NMSettingWireless *s_wifi;
|
NMSettingWireless *s_wifi;
|
||||||
NMSettingWirelessSecurity *s_wsec;
|
NMSettingWirelessSecurity *s_wsec;
|
||||||
NMSettingIPConfig *s_ip4;
|
NMSettingIPConfig *s_ip4;
|
||||||
gs_unref_object NMSupplicantConfig *config;
|
gs_unref_object NMSupplicantConfig *config = NULL;
|
||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
char *uuid;
|
char *uuid;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
@@ -46,7 +46,7 @@ _new_connection (const char *id)
|
|||||||
static void
|
static void
|
||||||
test_defname_no_connections (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);
|
name = nm_device_ethernet_utils_get_default_wired_name (NULL);
|
||||||
g_assert_cmpstr (name, ==, "Wired connection 1");
|
g_assert_cmpstr (name, ==, "Wired connection 1");
|
||||||
@@ -58,7 +58,7 @@ static void
|
|||||||
test_defname_no_conflict (void)
|
test_defname_no_conflict (void)
|
||||||
{
|
{
|
||||||
GSList *list = NULL;
|
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 ("asdfasdfasdfadf"));
|
||||||
list = g_slist_append (list, _new_connection ("work wifi"));
|
list = g_slist_append (list, _new_connection ("work wifi"));
|
||||||
@@ -76,7 +76,7 @@ static void
|
|||||||
test_defname_conflict (void)
|
test_defname_conflict (void)
|
||||||
{
|
{
|
||||||
GSList *list = NULL;
|
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 ("asdfasdfasdfadf"));
|
||||||
list = g_slist_append (list, _new_connection ("Wired connection 1"));
|
list = g_slist_append (list, _new_connection ("Wired connection 1"));
|
||||||
@@ -94,7 +94,7 @@ static void
|
|||||||
test_defname_multiple_conflicts (void)
|
test_defname_multiple_conflicts (void)
|
||||||
{
|
{
|
||||||
GSList *list = NULL;
|
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 ("random gsm connection"));
|
||||||
list = g_slist_append (list, _new_connection ("home wifi"));
|
list = g_slist_append (list, _new_connection ("home wifi"));
|
||||||
|
Reference in New Issue
Block a user