Fix several leaks.