Fix memory leak in file xfer on protocol error #4134