Stop warning and fix memory leaks.