Fix a memory leak found by LSan.