From 775cfba1d500b8717115c919ac7359cc682787d8 Mon Sep 17 00:00:00 2001 From: Marco Maggi Date: Tue, 30 Oct 2018 09:42:57 +0100 Subject: [PATCH] fixed warning about potential null pointer dereference --- expat/tests/runtests.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index dade0c8d..b6b0098e 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -8084,23 +8084,25 @@ START_TEST(test_misc_features) /* Prevent problems with double-freeing parsers */ g_parser = NULL; - if (features == NULL) + if (features == NULL) { fail("Failed to get feature information"); - /* Loop through the features checking what we can */ - while (features->feature != XML_FEATURE_END) { - switch(features->feature) { - case XML_FEATURE_SIZEOF_XML_CHAR: - if (features->value != sizeof(XML_Char)) - fail("Incorrect size of XML_Char"); - break; - case XML_FEATURE_SIZEOF_XML_LCHAR: - if (features->value != sizeof(XML_LChar)) - fail("Incorrect size of XML_LChar"); - break; - default: - break; + } else { + /* Loop through the features checking what we can */ + while (features->feature != XML_FEATURE_END) { + switch(features->feature) { + case XML_FEATURE_SIZEOF_XML_CHAR: + if (features->value != sizeof(XML_Char)) + fail("Incorrect size of XML_Char"); + break; + case XML_FEATURE_SIZEOF_XML_LCHAR: + if (features->value != sizeof(XML_LChar)) + fail("Incorrect size of XML_LChar"); + break; + default: + break; + } + features++; } - features++; } } END_TEST -- 2.40.0