From cd8f3cf09f7d4e869ca4930e8219bedab342ec6f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 2 Jun 2017 19:59:37 +0200 Subject: [PATCH] tests: work around coverity false-positives (cherry picked from commit c7c47575ce57d37037d20756cba7ed4af2f6c6bd) --- .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index e30d2d79b4..ef21680b6f 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -4970,15 +4970,16 @@ test_write_wired_aliases (void) if (!g_strcmp0 (addrstr, ip[j])) break; } - g_assert (j < num_addresses); - - g_assert_cmpint (nm_ip_address_get_prefix (addr), ==, 24); - if (label[j]) - g_assert_cmpstr (g_variant_get_string (nm_ip_address_get_attribute (addr, "label"), NULL), ==, label[j]); - else - g_assert (nm_ip_address_get_attribute (addr, "label") == NULL); - - ip[j] = NULL; + if (j >= num_addresses) + g_assert_not_reached (); + else { + g_assert_cmpint (nm_ip_address_get_prefix (addr), ==, 24); + if (label[j]) + g_assert_cmpstr (g_variant_get_string (nm_ip_address_get_attribute (addr, "label"), NULL), ==, label[j]); + else + g_assert (nm_ip_address_get_attribute (addr, "label") == NULL); + ip[j] = NULL; + } } for (i = 0; i < num_addresses; i++)