2 /* To be run with --freelist-vol=1000000 --freelist-big-blocks=50000 */
3 static void jumped(void)
7 int main(int argc
, char *argv
[])
12 char *other_small
= NULL
;
16 /* Verify that access via a dangling pointer to a big block bigger than
17 the free list is found by memcheck (still on the free list). */
18 semi_big
= malloc (900000);
19 big
= malloc (1000015);
22 if (big
[1000] > 0x0) jumped();
23 if (semi_big
[1000] > 0x0) jumped();
25 /* Then verify that dangling pointers for small blocks is not hampered
26 by doing big alloc/free. */
27 small
= malloc (10000);
30 /* We should still have a nice error msg for the semi_big
31 but not for the big block, which has been removed from the free list
32 with the malloc of small above. */
33 if (big
[2000] > 0x0) jumped();
34 if (semi_big
[2000] > 0x0) jumped();
39 big
= malloc (1000015);
41 if (small
[10] > 0x0) jumped();
43 /* Do not common up the below in a loop. We
44 want a different error/stack trace for each of
46 if (big
[10] > 0x0) jumped();
50 for (i
= 0; i
< 100; i
++) {
51 other_small
= malloc(10000);
52 for (j
= 0; j
< 10000; j
++)
55 if (small
[10] > 0x0) jumped();