use the stack to allocate number_string and free path_copy on error