Fix some memory leaks