Fix minor unit test memory leaks
Merge pull request #3017 from sipa/unitleaks

Fix minor unit test memory leaks