Without seeing all your malloc and free calls, it's impossible to say.

Run the program through valgrind if you want a diagnostic.