Fix possible memory leak in test-file