tally: fix FreeBSD compile, memleak in tests.