Fix minor memory leaks