Fix memleaks.