added function path_alloc()