Fix memory leaks.

Fix memory leaks.