Halo: fix memory leaks