CLOUD: Fix UploadFileClientHandler

A few possible memory leaks about `_contentStream` there.
This commit is contained in:
Alexander Tkachev 2016-07-26 13:01:09 +06:00
parent 46dda5fce0
commit 2c34864a06

View File

@ -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(