1
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 static void* return_arg(void* q);
main(void)6 int main ( void )
7 {
8 void* p = (void*)0x87654321;
9 int q[] = { 1, 2, 3 };
10
11 /* Free a pointer to Never-Never Land */
12 free(p);
13
14 /* Free a pointer to a stack block */
15 free(return_arg(q));
16
17 return 0;
18 }
19
20 /*
21 * The only purpose of the function below is to make sure that gcc 4.4.x does
22 * not print the following warning during the compilation of this test program:
23 * warning: attempt to free a non-heap object
24 */
return_arg(void * q)25 static void* return_arg(void* q)
26 {
27 return q;
28 }
29
30