Originally Posted by
Salem
Well if you've generally made a mess of memory, then any part of your code could look like it's messing with the data belonging to any other part of the code.
You're observing an effect, but when it comes to memory corruption, this is very seldom the cause.
You could try
gcc -g prog.c -lefence
Then
gdb a.out
run
With any luck, that should trap on the first instruction which does something 'iffy' with allocated memory (like using it after being freed or stepping off the end).