fix memory leaks

they were detected by instruments