Mysterious crash on exit

Since I switched to using SDL2 for my project I noticed a problem
everytime I exit the application:

*** glibc detected *** ./lk: corrupted double-linked list:
0x00000000018bf840 ***

I have tried to trace the error, but gdb seems no longer able to track
the error (Im using ddd and it simply freezes forever when I request the
backtrace). I remember that the first time I did it, the problem seemed
to be outside my code. Any idea about how to solve this?–
Roger D. Vargas
Using Gentoo Linux 2010
La unica forma de encontrar los limites de lo posible es yendo mas
alla de ellos, hacia lo imposible

It sounds like some kind of memory corruption.

You could try using Electric Fence ( or Valgrind (

They may be able to narrow down the issue.