fixed a memory leak in utils get_path