venkat
venkat

Reputation: 267

glibc detected *** ./a.out: free(): invalid pointer:

when i compiled(c++ program) in linux i am getting following error pls help me

glibc detected *** ./a.out: free(): invalid pointer:0x0804878d ***
======= Backtrace: =========
/lib/libc.so.6[0xbd5f18]
/lib/libc.so.6(__libc_free+0x79)[0xbd941d]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0x3233fe1]
./a.out(__gxx_personality_v0+0x100)[0x8048514]
./a.out(__gxx_personality_v0+0x176)[0x804858a]
/lib/libc.so.6(__libc_start_main+0xdc)[0xb877e4]
./a.out(__gxx_personality_v0+0x5d)[0x8048471]
======= Memory map: ========
00b55000-00b6e000 r-xp 00000000 fd:00 6687029    /lib/ld-2.4.so
00b6e000-00b6f000 r-xp 00018000 fd:00 6687029    /lib/ld-2.4.so
00b6f000-00b70000 rwxp 00019000 fd:00 6687029    /lib/ld-2.4.so
00b72000-00c9e000 r-xp 00000000 fd:00 6687030    /lib/libc-2.4.so
00c9e000-00ca1000 r-xp 0012b000 fd:00 6687030    /lib/libc-2.4.so
00ca1000-00ca2000 rwxp 0012e000 fd:00 6687030    /lib/li

Upvotes: 1

Views: 5054

Answers (2)

Tim Boddy
Tim Boddy

Reputation: 1069

If you look at these two lines of the stack trace, you will see that the page that starts at 0x8048000 must be executable (because two addresses within that page, 0x8048514 and 0x804858a appear as return addresses on the stack).

./a.out(__gxx_personality_v0+0x100)[0x8048514] ./a.out(__gxx_personality_v0+0x176)[0x804858a]

The address you are trying to free, 0x0804878d, is at offset 0x78d in that same page so it probably points to code and definitely points within a page that is executable.

Upvotes: 0

mtvec
mtvec

Reputation: 18316

glibc detected * ./a.out: free(): invalid pointer:0x0804878d *

This means you probablydeleted a pointer that hasn't been created with new.

If you want any useful help, you really should post the code that generates this problem.

Upvotes: 3

Related Questions