blob: 7b1fbf1e010259376507f261503fefb33745be14 [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
mueller535cc6e2004-01-03 14:18:02 +00006#include <stdlib.h>
njn25e49d8e72002-09-23 09:36:25 +00007#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