Fix mem leaks.