Leak fixes

More results of valgrind logs, from a few weeks back, plus a leak found thanks to a compiler warning while doing a test-build after rebasing.