Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid pointer in tb_shutdown() #47

Closed
sternenseemann opened this issue Jan 18, 2015 · 5 comments
Closed

invalid pointer in tb_shutdown() #47

sternenseemann opened this issue Jan 18, 2015 · 5 comments

Comments

@sternenseemann
Copy link
Contributor

*** Error in `/home/lukas/Hacking/c/tinyrl/bin/tinyrl': munmap_chunk(): invalid pointer: 0x0000000000607f80 ***
^[[C======= Backtrace: =========
/usr/lib/libc.so.6(+0x732ae)[0x7ffff77a62ae]
/usr/lib/libc.so.6(+0x7872e)[0x7ffff77ab72e]
/home/lukas/Hacking/c/tinyrl/bin/tinyrl[0x402c88]
/home/lukas/Hacking/c/tinyrl/bin/tinyrl[0x4032f3]
/home/lukas/Hacking/c/tinyrl/bin/tinyrl[0x4021bc]
/usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7ffff7753040]
/home/lukas/Hacking/c/tinyrl/bin/tinyrl[0x400e59]
======= Memory map: ========
00400000-00406000 r-xp 00000000 fe:03 3932165                            /home/lukas/Hacking/c/tinyrl/bin/tinyrl
00606000-00607000 rw-p 00006000 fe:03 3932165                            /home/lukas/Hacking/c/tinyrl/bin/tinyrl
00607000-00676000 rw-p 00000000 00:00 0                                  [heap]
7ffff751d000-7ffff7533000 r-xp 00000000 fe:04 13590                      /usr/lib/libgcc_s.so.1
7ffff7533000-7ffff7732000 ---p 00016000 fe:04 13590                      /usr/lib/libgcc_s.so.1
7ffff7732000-7ffff7733000 rw-p 00015000 fe:04 13590                      /usr/lib/libgcc_s.so.1
7ffff7733000-7ffff78cc000 r-xp 00000000 fe:04 13264                      /usr/lib/libc-2.20.so
7ffff78cc000-7ffff7acc000 ---p 00199000 fe:04 13264                      /usr/lib/libc-2.20.so
7ffff7acc000-7ffff7ad0000 r--p 00199000 fe:04 13264                      /usr/lib/libc-2.20.so
7ffff7ad0000-7ffff7ad2000 rw-p 0019d000 fe:04 13264                      /usr/lib/libc-2.20.so
7ffff7ad2000-7ffff7ad6000 rw-p 00000000 00:00 0 
7ffff7ad6000-7ffff7bd9000 r-xp 00000000 fe:04 13263                      /usr/lib/libm-2.20.so
7ffff7bd9000-7ffff7dd9000 ---p 00103000 fe:04 13263                      /usr/lib/libm-2.20.so
7ffff7dd9000-7ffff7dda000 r--p 00103000 fe:04 13263                      /usr/lib/libm-2.20.so
7ffff7dda000-7ffff7ddb000 rw-p 00104000 fe:04 13263                      /usr/lib/libm-2.20.so
7ffff7ddb000-7ffff7dfd000 r-xp 00000000 fe:04 13237                      /usr/lib/ld-2.20.so
7ffff7ff3000-7ffff7ff8000 rw-p 00000000 00:00 0 
7ffff7ff8000-7ffff7ffa000 r--p 00000000 00:00 0                          [vvar]
7ffff7ffa000-7ffff7ffc000 r-xp 00000000 00:00 0                          [vdso]
7ffff7ffc000-7ffff7ffd000 r--p 00021000 fe:04 13237                      /usr/lib/ld-2.20.so
7ffff7ffd000-7ffff7ffe000 rw-p 00022000 fe:04 13237                      /usr/lib/ld-2.20.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0 
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0                          [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

I recently experienced this strange error when my program quitted. It is related to tb_shutdown() as I found out by using valgrind: valgrind error. I don't have any idea how to fix this yet.

@nsf
Copy link
Owner

nsf commented Jan 18, 2015

If you call tb_shutdown twice, then it's possible.

@nsf
Copy link
Owner

nsf commented Jan 18, 2015

And that's what valgrind says..

You call tb_shutdown at main.c:446
==22975== by 0x4032F2: tb_shutdown (termbox.c:143)
==22975== by 0x4021AC: main (main.c:446)

And then again at main.c:451
==22975== by 0x403258: tb_shutdown (termbox.c:135)
==22975== by 0x4021BB: main (main.c:451)

@nsf
Copy link
Owner

nsf commented Jan 18, 2015

Will add a guard which protects you from doing so..

@sternenseemann
Copy link
Contributor Author

ah! Thank you.

@sternenseemann
Copy link
Contributor Author

Guard sounds like a good idea. Actually I called tb_shutdown twice, you are right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants