From c2084de48da56d38aee5809afca70bd7aa3f5865 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Wed, 26 Jul 2017 18:01:53 +0100 Subject: [PATCH] Make test_nsalloc_realloc_longer_prefix_count() robust. Remove test's vulnerability to changing memory allocation patterns --- expat/tests/runtests.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 971f47b2..a72d4092 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -11038,12 +11038,13 @@ START_TEST(test_nsalloc_realloc_longer_prefix) #define MAX_REALLOC_COUNT 12 for (i = 0; i < MAX_REALLOC_COUNT; i++) { - /* Every reallocation bar the last is cached */ - reallocation_count = (i == 0) ? 0 : 1; + reallocation_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 reallocations");