8 hours later, error found.
Valgrind is your friend.