Fix users of prefix_path() to free() only when necessary