From 969031fe44bbcfbaf8e6deb0ff2af982b0ae3087 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Wed, 26 Jul 2017 17:47:48 +0100 Subject: [PATCH] Make test_nsalloc_long_attr() robust vs allocation pattern changes --- expat/tests/runtests.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 44a65be1..c790af01 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -10682,32 +10682,16 @@ START_TEST(test_nsalloc_long_attr) "xmlns:bar='http://example.org/'>" ""; int i; -#define MAX_ALLOC_COUNT 20 - int repeated = 0; +#define MAX_ALLOC_COUNT 40 for (i = 0; i < MAX_ALLOC_COUNT; i++) { - /* Repeat some tests with the same allocation count to - * catch cached allocation not freed by XML_ParserReset() - */ - if ((i == 4 && repeated < 6) || - (i == 7 && repeated == 8) || - (i == 10 && repeated == 10)) { - i -= 2; - repeated++; - } - else if ((i == 2 && repeated < 2) || - (i == 3 && - (repeated == 2 || repeated == 4 || repeated == 6)) || - (i == 5 && repeated == 7) || - (i == 6 && repeated == 9)) { - i--; - repeated++; - } allocation_count = i; if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) break; - XML_ParserReset(parser, NULL); + /* See comment in test_nsalloc_xmlns() */ + nsalloc_teardown(); + nsalloc_setup(); } if (i == 0) fail("Parsing worked despite failing allocations");