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

index 64da4c9c7cd5aee3ef0fed6b19513a356824dde8..0c2bddbf7607bb60038c5684a6c11c5b84aa671b 100644 (file)
@@ -8842,20 +8842,9 @@ START_TEST(test_alloc_parse_public_doctype)
         "' 'test'>\n"
         "<doc></doc>";
     int i;
-#define MAX_ALLOC_COUNT 10
-    int repeat = 0;
+#define MAX_ALLOC_COUNT 25
 
     for (i = 0; i < MAX_ALLOC_COUNT; i++) {
-        /* Repeat certain counts to defeat cached allocations */
-        if (i == 4 && repeat == 5) {
-            i -= 2;
-            repeat++;
-        }
-        else if ((i == 2 && repeat < 3) ||
-            (i == 3 && repeat < 5)) {
-            i--;
-            repeat++;
-        }
         allocation_count = i;
         dummy_handler_flags = 0;
         XML_SetDoctypeDeclHandler(parser,
@@ -8864,7 +8853,9 @@ START_TEST(test_alloc_parse_public_doctype)
         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 failing allocator");