From: Rhodri James Date: Thu, 27 Jul 2017 12:41:02 +0000 (+0100) Subject: Make test_alloc_attribute_enum_value() robust vs allocation changes X-Git-Tag: R_2_2_3~16^2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5013e2f65d29202673a48f2cf185aaa38b1b2c36;p=libexpat Make test_alloc_attribute_enum_value() robust vs allocation changes --- diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 54ef10bd..3ec087ad 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -8979,22 +8979,9 @@ START_TEST(test_alloc_attribute_enum_value) "\n" ""; int i; -#define MAX_ALLOC_COUNT 20 - int repeat = 0; +#define MAX_ALLOC_COUNT 30 for (i = 0; i < MAX_ALLOC_COUNT; i++) { - /* Repeat some counts to allow for cached allocations */ - if (i == 13 && repeat == 5) { - i -= 2; - repeat++; - } - else if ((i == 2 && repeat < 2) || - (i == 3 && repeat == 2) || - (i == 8 && repeat == 3) || - (i == 9 && repeat == 4)) { - i--; - repeat++; - } allocation_count = i; XML_SetExternalEntityRefHandler(parser, external_entity_alloc); XML_SetUserData(parser, dtd_text); @@ -9004,7 +8991,9 @@ START_TEST(test_alloc_attribute_enum_value) 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");