Remove some memory leaks.