Fix a memory leak and free the file info list properly when renaming files.