From 37b3f303bfc53aee0f5df7c91cbd92fc1bc88b41 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Thu, 27 Jul 2017 13:37:48 +0100 Subject: [PATCH] Make test_alloc_parse_public_doctype_long_name() robust vs allocation --- expat/tests/runtests.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 0c2bddbf..6a3fbab6 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -8893,20 +8893,9 @@ START_TEST(test_alloc_parse_public_doctype_long_name) "'>\n" ""; int i; -#define MAX_ALLOC_COUNT 10 - int repeat = 0; +#define MAX_ALLOC_COUNT 25 for (i = 0; i < MAX_ALLOC_COUNT; i++) { - /* Repeat some counts to defeat cached allocations */ - if (i == 4 && repeat == 6) { - i -= 2; - repeat++; - } - else if ((i == 2 && repeat < 3) || - (i == 3 && repeat < 6)) { - i--; - repeat++; - } allocation_count = i; XML_SetDoctypeDeclHandler(parser, dummy_start_doctype_decl_handler, @@ -8914,7 +8903,9 @@ START_TEST(test_alloc_parse_public_doctype_long_name) 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");