Fix some previously introduced memleaks