Fix a memory leak issue