diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-02-09 15:17:53 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-02-09 15:19:30 +0100 |
commit | 2981839bdedc5f75d5484e660acf67fa03a61e90 (patch) | |
tree | a7cfbe2fcf8f159dedba69b52159ba0d0f24be32 /libnm-core/tests | |
parent | b0b15e47183eaf7526628efdf4dfdd25391cbfad (diff) | |
download | NetworkManager-2981839bdedc5f75d5484e660acf67fa03a61e90.tar.gz |
test: initialize auto-destructed pointers
Otherwise the compiler complains that they could be left uninitialized in case
the function returns too early.
Fixes: 76745817c3e77b7d6c22290a7564b73224147516
Diffstat (limited to 'libnm-core/tests')
-rw-r--r-- | libnm-core/tests/test-crypto.c | 2 | ||||
-rw-r--r-- | libnm-core/tests/test-general.c | 20 | ||||
-rw-r--r-- | libnm-core/tests/test-setting-dcb.c | 10 |
3 files changed, 16 insertions, 16 deletions
diff --git a/libnm-core/tests/test-crypto.c b/libnm-core/tests/test-crypto.c index b6ed2b11af..e4ca808659 100644 --- a/libnm-core/tests/test-crypto.c +++ b/libnm-core/tests/test-crypto.c @@ -98,7 +98,7 @@ out: static void test_cert (gconstpointer test_data) { - gs_free char *path; + gs_free char *path = NULL; GByteArray *array; NMCryptoFileFormat format = NM_CRYPTO_FILE_FORMAT_UNKNOWN; GError *error = NULL; diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 2a091187a8..7df4e57aa5 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -649,7 +649,7 @@ test_setting_ip4_config_address_data (void) static void test_setting_gsm_apn_spaces (void) { - gs_unref_object NMSettingGsm *s_gsm; + gs_unref_object NMSettingGsm *s_gsm = NULL; const char *tmp; s_gsm = (NMSettingGsm *) nm_setting_gsm_new (); @@ -677,7 +677,7 @@ test_setting_gsm_apn_spaces (void) static 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 (); ASSERT (s_gsm != NULL, @@ -715,7 +715,7 @@ test_setting_gsm_apn_bad_chars (void) static 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 (); g_assert (s_gsm); @@ -730,7 +730,7 @@ test_setting_gsm_apn_underscore (void) static 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 (); g_assert (s_gsm); @@ -2390,7 +2390,7 @@ test_connection_bad_base_types (void) static void test_setting_compare_id (void) { - gs_unref_object NMSetting *old, *new; + gs_unref_object NMSetting *old = NULL, *new = NULL; gboolean success; old = nm_setting_connection_new (); @@ -2414,7 +2414,7 @@ test_setting_compare_id (void) static void test_setting_compare_timestamp (void) { - gs_unref_object NMSetting *old, *new; + gs_unref_object NMSetting *old = NULL, *new = NULL; gboolean success; old = nm_setting_connection_new (); @@ -2459,7 +2459,7 @@ static void test_setting_compare_secrets (gconstpointer test_data) { const TestDataCompareSecrets *data = test_data; - gs_unref_object NMSetting *old, *new; + gs_unref_object NMSetting *old = NULL, *new = NULL; gboolean success; /* Make sure that a connection with transient/unsaved secrets compares @@ -2490,7 +2490,7 @@ static void test_setting_compare_vpn_secrets (gconstpointer test_data) { const TestDataCompareSecrets *data = test_data; - gs_unref_object NMSetting *old, *new; + gs_unref_object NMSetting *old = NULL, *new = NULL; gboolean success; /* Make sure that a connection with transient/unsaved secrets compares @@ -2766,7 +2766,7 @@ test_setting_connection_changed_signal (void) NMConnection *connection; gboolean changed = FALSE; NMSettingConnection *s_con; - gs_free char *uuid; + gs_free char *uuid = NULL; connection = nm_simple_connection_new (); g_signal_connect (connection, @@ -3172,7 +3172,7 @@ test_setting_802_1x_changed_signal (void) static 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, * like this one. Test that we maintain compatibility. */ diff --git a/libnm-core/tests/test-setting-dcb.c b/libnm-core/tests/test-setting-dcb.c index 2265db8905..f7554e81a5 100644 --- a/libnm-core/tests/test-setting-dcb.c +++ b/libnm-core/tests/test-setting-dcb.c @@ -37,7 +37,7 @@ static void test_dcb_flags_valid (void) { - gs_unref_object NMSettingDcb *s_dcb; + gs_unref_object NMSettingDcb *s_dcb = NULL; GError *error = NULL; gboolean success; guint i; @@ -90,7 +90,7 @@ test_dcb_flags_valid (void) static void test_dcb_flags_invalid (void) { - gs_unref_object NMSettingDcb *s_dcb; + gs_unref_object NMSettingDcb *s_dcb = NULL; GError *error = NULL; gboolean success; @@ -149,7 +149,7 @@ test_dcb_flags_invalid (void) static void test_dcb_app_priorities (void) { - gs_unref_object NMSettingDcb *s_dcb; + gs_unref_object NMSettingDcb *s_dcb = NULL; GError *error = NULL; gboolean success; @@ -211,7 +211,7 @@ test_dcb_app_priorities (void) static void test_dcb_priorities_valid (void) { - gs_unref_object NMSettingDcb *s_dcb; + gs_unref_object NMSettingDcb *s_dcb = NULL; GError *error = NULL; gboolean success; guint i; @@ -270,7 +270,7 @@ test_dcb_priorities_valid (void) static void test_dcb_bandwidth_sums (void) { - gs_unref_object NMSettingDcb *s_dcb; + gs_unref_object NMSettingDcb *s_dcb = NULL; GError *error = NULL; gboolean success; |