]> granicus.if.org Git - libexpat/commitdiff
Make test_alloc_system_notation() robust vs allocation changes
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 12:50:19 +0000 (13:50 +0100)
committerRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 12:50:19 +0000 (13:50 +0100)
expat/tests/runtests.c

index c2cd11de4fb403f2e53329eb1c3808198b42054f..06fd4641fc4e2853135bca717c0f4f6d853d8d2c 100644 (file)
@@ -9315,23 +9315,18 @@ START_TEST(test_alloc_system_notation)
         "<!ELEMENT doc EMPTY>\n"
         "]>\n<doc/>";
     int i;
-#define MAX_ALLOC_COUNT 10
-    int repeat = 0;
+#define MAX_ALLOC_COUNT 20
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
-        /* Repeat some counts to allow for cached allocations */
-        if ((i == 2 && repeat < 5) ||
-            (i == 3 && repeat == 5)) {
-            i--;
-            repeat++;
-        }
         allocation_count = i;
         dummy_handler_flags = 0;
         XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler);
         if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text),
                                     XML_TRUE) != XML_STATUS_ERROR)
             break;
-        XML_ParserReset(parser, NULL);
+        /* See comment in test_alloc_parse_xdecl() */
+        alloc_teardown();
+        alloc_setup();
     }
     if (i == 0)
         fail("Parse succeeded despite allocation failures");