This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
malloc/free question..
- From: I Rattan <ratta1i at cps dot cmich dot edu>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 16 Mar 2012 19:14:48 -0400 (EDT)
- Subject: malloc/free question..
Under Linux with gcc version 4.4.6 (Debian 4.4.6-11)
The following code:
int main(int argv, char** args)
{
int *arr;
int n;
n = 10000000;
arr = (int *)malloc(4*n);
free((void *)&arr);
exit(0);
}
generates warning:
err.c:14: warning: attempt to free a non-heap object 'arr'
any ideas?
-ishwar