Fix a memory leak when running the unit tests.