mirror of
https://github.com/ioacademy-jikim/debugging
synced 2025-06-08 08:26:14 +00:00
30 lines
558 B
C
30 lines
558 B
C
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
static void* return_arg(void* q);
|
|
int main ( void )
|
|
{
|
|
void* p = (void*)0x87654321;
|
|
int q[] = { 1, 2, 3 };
|
|
|
|
/* Free a pointer to Never-Never Land */
|
|
free(p);
|
|
|
|
/* Free a pointer to a stack block */
|
|
free(return_arg(q));
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* The only purpose of the function below is to make sure that gcc 4.4.x does
|
|
* not print the following warning during the compilation of this test program:
|
|
* warning: attempt to free a non-heap object
|
|
*/
|
|
static void* return_arg(void* q)
|
|
{
|
|
return q;
|
|
}
|
|
|