Address unfreed memory in file upload encoding method.