Make test_nsalloc_realloc_longer_prefix_count() robust.

Remove test's vulnerability to changing memory allocation patterns
This commit is contained in:
Rhodri James 2017-07-26 18:01:53 +01:00
parent a74053cf48
commit c2084de48d

View File

@ -11038,12 +11038,13 @@ START_TEST(test_nsalloc_realloc_longer_prefix)
#define MAX_REALLOC_COUNT 12 #define MAX_REALLOC_COUNT 12
for (i = 0; i < MAX_REALLOC_COUNT; i++) { for (i = 0; i < MAX_REALLOC_COUNT; i++) {
/* Every reallocation bar the last is cached */ reallocation_count = i;
reallocation_count = (i == 0) ? 0 : 1;
if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text),
XML_TRUE) != XML_STATUS_ERROR) XML_TRUE) != XML_STATUS_ERROR)
break; break;
XML_ParserReset(parser, NULL); /* See comment in test_nsalloc_xmlns() */
nsalloc_teardown();
nsalloc_setup();
} }
if (i == 0) if (i == 0)
fail("Parsing worked despite failing reallocations"); fail("Parsing worked despite failing reallocations");