fix memory leak (pathtree)