fix memory leaks in is_reduced functions