Prevent memory leaks.