1 #include <stdlib.h>
2 //#include <malloc.h>
3 #include "../memcheck.h"
main(int argc,char * argv[])4 int main (int argc, char*argv[])
5 {
6 size_t def_size = 1<<20;
7 char *p;
8 char *new_p;
9
10 if (argc > 10000) def_size = def_size * 2;
11
12 {
13 size_t size = def_size;
14 (void) VALGRIND_MAKE_MEM_UNDEFINED(&size, 1);
15 p = malloc(size);
16 }
17
18 (void) VALGRIND_MAKE_MEM_UNDEFINED(&p, 1);
19 new_p = realloc(p, def_size);
20
21 (void) VALGRIND_MAKE_MEM_UNDEFINED(&new_p, 1);
22 new_p = realloc(new_p, def_size);
23
24 (void) VALGRIND_MAKE_MEM_UNDEFINED(&new_p, 1);
25 free (new_p);
26
27 {
28 size_t nmemb = 1;
29 (void) VALGRIND_MAKE_MEM_UNDEFINED(&nmemb, 1);
30 new_p = calloc(nmemb, def_size);
31 free (new_p);
32 }
33 #if 0
34 {
35 size_t alignment = 1;
36 (void) VALGRIND_MAKE_MEM_UNDEFINED(&alignment, 1);
37 new_p = memalign(alignment, def_size);
38 free(new_p);
39 }
40
41 {
42 size_t nmemb = 16;
43 size_t size = def_size;
44 (void) VALGRIND_MAKE_MEM_UNDEFINED(&size, 1);
45 new_p = memalign(nmemb, size);
46 free(new_p);
47 }
48
49 {
50 size_t size = def_size;
51 (void) VALGRIND_MAKE_MEM_UNDEFINED(&size, 1);
52 new_p = valloc(size);
53 free (new_p);
54 }
55 #endif
56 return 0;
57 }
58