Fix a few potential memory leaks.