I'm wondering why randomly after executing the ./a.out I get the following. Any ideas what I'm doing wrong? Thanks
+2
A:
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
Alexandre Jasmin
2010-03-13 01:58:28
so basically is because I'm freeing more times that I supposed to?
Mike
2010-03-13 01:59:52
yes, you are. :)
vladr
2010-03-13 03:10:37
It is also possible that you are writing to memory that you are not supposed to be writing to.
Gabe
2010-03-13 03:27:58