Avoid memory leaks.