[linux] probleme avec free()
bonjour,
je travail sous eclipse j'ai un processeur 64 bits peut être le cause ?
j'ai juste fait un petit programme de test :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #include <stdio.h>
#include <stdlib.h>
int main (int argc, char** argv)
{
int c=5;
int * point =(int*) malloc( sizeof(int));
printf("%d\n le c",c);
point=&c;
*point=6;
printf("%d le point\n",c);
free(point);
return 0;} |
le programme me retourne une erreur :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| *** glibc detected *** /home/dev/workspace/pointuer/Debug/pointuer: free(): invalid pointer: 0xbf8ea88c ***
======= Backtrace: =========
/lib/libc.so.6[0x4d83adf1]
/lib/libc.so.6(cfree+0x90)[0x4d83e430]
/home/dev/workspace/pointuer/Debug/pointuer[0x804846d]
/lib/libc.so.6(__libc_start_main+0xe0)[0x4d7e8f70]
/home/dev/workspace/pointuer/Debug/pointuer[0x8048351]
======= Memory map: ========
08048000-08049000 r-xp 00000000 fd:00 10420814 /home/dev/workspace/pointuer/Debug/pointuer
08049000-0804a000 rwxp 00000000 fd:00 10420814 /home/dev/workspace/pointuer/Debug/pointuer
0892c000-0894d000 rwxp 0892c000 00:00 0
4ce02000-4ce1d000 r-xp 00000000 fd:00 14712871 /lib/ld-2.6.so
4ce1d000-4ce1e000 r-xp 0001a000 fd:00 14712871 /lib/ld-2.6.so
4ce1e000-4ce1f000 rwxp 0001b000 fd:00 14712871 /lib/ld-2.6.so
4d7d3000-4d921000 r-xp 00000000 fd:00 14712873 /lib/libc-2.6.so
4d921000-4d923000 r-xp 0014e000 fd:00 14712873 /lib/libc-2.6.so
4d923000-4d924000 rwxp 00150000 fd:00 14712873 /lib/libc-2.6.so
4d924000-4d927000 rwxp 4d924000 00:00 0
4e3ba000-4e3c5000 r-xp 00000000 fd:00 14713989 /lib/libgcc_s-4.1.2-20070503.so.1
4e3c5000-4e3c6000 rwxp 0000a000 fd:00 14713989 /lib/libgcc_s-4.1.2-20070503.so.1
b7d00000-b7d21000 rwxp b7d00000 00:00 0
b7d21000-b7e00000 --xp b7d21000 00:00 0
b7f07000-b7f08000 rwxp b7f07000 00:00 0
b7f1c000-b7f1e000 rwxp b7f1c000 00:00 0
b7f1e000-b7f1f000 r-xp b7f1e000 00:00 0 [vdso]
bf8d8000-bf8ee000 rw-p bf8d8000 00:00 0 [stack] |