What you need is printf() debugging. Just throw a bunch of printf() calls into the function and look what the last message is before the application crashes. The pointer you used after the printf() call is most likely the evil one.

First you should narrow the region of the crash down by putting a few printf() into the function, then you put some more printf() calls into the region where you assume the crash is. When you believe you found the line, alter it and look if the crash changes.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com