I’m getting
*** glibc detected *** (/my/program/…): malloc(): memory corruption: 0xf28000fa ***
I’ve run under valgrind, which reports cases of reading memory that has been freed, but no cases of illegal memory writes.
Could reading freed memory cause memory corruption? If not, any suggestions where else to look beyond the valgrind output?
You can use GDB to watch each write in this memory address, like this:
Then you can debug where the problem is.
Reading doesn’t cause memory corruption, but there are a lot of situations that you don’t even imagine that could be the cause of this, and Valgrind is not a perfect tool.
See more information about debugging memory issues here.