Fix all memory leaks.