memory (leaks) after executing
I'm wondering 开发者_StackOverflowwhy randomly after executing the ./a.out I get the following. Any ideas what I'm doing wrong? Thanks
http://img710.imageshack.us/img710/8708/trasht.png
As the error suggests you probably have a double free() or heap corruption
Edit: Either you're freeing the same buffer more than once or you're writing bytes in a memory region you shouldn't be writing to. The latter might be caused by writing in the buffer after freeing it or writing outside the buffer bounds.
Perhaps Memcheck can help pinpoint the problem.
Compile your program with debug information cc -g
and run valgrind ./a.out
精彩评论