]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/massif/tests/realloc.c
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / massif / tests / realloc.c
1 #include <stdlib.h>
2
3 int main(void)
4 {                                // All sizes are multiples of 16 -- no slop.
5    int* x = realloc(NULL, 800);  // equivalent to malloc(800), and ends up
6    int* y __attribute__((unused)); // calling Valgrind's (and Massif's) malloc
7
8    x = realloc(x, 800);          // same size
9
10    x = realloc(x, 400);          // smaller
11
12    x = realloc(x, 1200);         // bigger
13
14    y = realloc(x+10, 1600);      // bogus realloc
15
16    x = realloc(x, 0);            // equivalent to free(x), and ends up
17                                  // calling Valgrind's (and Massif's) free
18    return 0;
19 }