diff options
Diffstat (limited to 'backends/networking')
-rw-r--r-- | backends/networking/sdl_net/uploadfileclienthandler.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/backends/networking/sdl_net/uploadfileclienthandler.cpp b/backends/networking/sdl_net/uploadfileclienthandler.cpp index 048ff39810..e2832bcba5 100644 --- a/backends/networking/sdl_net/uploadfileclienthandler.cpp +++ b/backends/networking/sdl_net/uploadfileclienthandler.cpp @@ -137,6 +137,12 @@ void UploadFileClientHandler::handleBlockHeaders(Client *client) { return; } + // remove previous stream (if there is one) + if (_contentStream) { + delete _contentStream; + _contentStream = nullptr; + } + // create file stream (and necessary subdirectories) Common::DumpFile *f = new Common::DumpFile(); if (!f->open(originalNode->getPath(), true)) { @@ -156,6 +162,9 @@ void UploadFileClientHandler::handleBlockContent(Client *client) { _contentStream->flush(); ++_uploadedFiles; + delete _contentStream; + _contentStream = nullptr; + if (client->noMoreContent()) { // success - redirect back to directory listing HandlerUtils::setMessageHandler( |