]> granicus.if.org Git - libexpat/commitdiff
fixed warning about potential null pointer dereference
authorMarco Maggi <marco.maggi-ipsu@poste.it>
Tue, 30 Oct 2018 08:42:57 +0000 (09:42 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 22 Jul 2019 21:15:12 +0000 (23:15 +0200)
expat/tests/runtests.c

index dade0c8d1fab1f3597c3467462572b974a8df88e..b6b0098ed2de7d6b85d13bb415804865380fe745 100644 (file)
@@ -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