Remove some memory leaks