[Reviewer: Andy][From: Alex] Fix valgrind errors.

Andy please can you review some fixes to make chronos tests run cleanly under valgrind (which I didn't spot because `make test` does not use valgrind).