Fix various memleaks in the tests
Merge pull request #439 from xhochy/test-memleaks

Fix various memleaks in the tests