Fix memory leaks.

I think.