make tests more valgrind-friendly by not leaking memory