I was randomly getting errors (1 run in 50 would reproduce) like:
$ ./myprogram *** glibc detected *** double free or corruption (out): 0x093014a4 ***
Linux has a randomization of virtual address space which is supposed to help thwart buffer overflow attacks etc.
This can cause errors to randomly not show, so in the spirit of trying to consistently reproduce the problem I disabled this using:
$ setarch x86_64 -R ./myprogram
This didn’t seem to help.
$ valgrind --tool=memcheck ./myprogram
The output of this produced a:
Invalid free which showed where the error was.