Fixed a memory leak in tests.c