blob: c89ff8aabdfedd9a9dea2c371318b1c235f544bd [file] [log] [blame]
njn25e49d8e72002-09-23 09:36:25 +00001/* This test demonstrated an obscure bug in malloclists handling caused by
2 multiple blocks hashing to the same list and one being overwritten at
3 realloc time due to bad ordering of the things happening. Now runs
4 without error. */
5
6#include <malloc.h>
7#include <stdio.h>
8
9int main ( void )
10{
11 char* p;
12 int i;
13 for (i = 0; i < 10000; i++) {
14 p = malloc(10 + 10 * (i % 100));
15 p = realloc(p, 500);
16 p = realloc(p, 600);
17 free(p);
18 }
19 return 0;
20}
21