Make test_alloc_attribute_predefined_entity() robust vs allocation

This commit is contained in:
Rhodri James 2017-07-27 14:15:16 +01:00
parent 88436b3723
commit 1bea11a178

View File

@ -9630,26 +9630,16 @@ START_TEST(test_alloc_attribute_predefined_entity)
{
const char *text = "<doc a='&amp;'></doc>";
int i;
#define MAX_ALLOC_COUNT 10
int repeat = 0;
#define MAX_ALLOC_COUNT 15
for (i = 0; i < MAX_ALLOC_COUNT; i++) {
/* Repeat some counts to defeat cached allocations */
if (i == 3 && repeat == 1) {
i -= 2;
repeat++;
}
else if ((i == 2 &&
(repeat == 0 || repeat == 2 || repeat == 3)) ||
(i == 3 && repeat == 4)) {
i--;
repeat++;
}
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_alloc_parse_xdecl() */
alloc_teardown();
alloc_setup();
}
if (i == 0)
fail("Parse succeeded despite failing allocator");