diff --git a/backends/cloud/cloudmanager.cpp b/backends/cloud/cloudmanager.cpp index ed48ec50795..3e1c94f9094 100644 --- a/backends/cloud/cloudmanager.cpp +++ b/backends/cloud/cloudmanager.cpp @@ -240,6 +240,7 @@ void CloudManager::connectStorage(uint32 index, Common::String code) { // in these constructors Storages request token using the passed code // when the token is received, they call replaceStorage() // or removeStorage(), if some error occurred + // thus, no memory leak happens } void CloudManager::printBool(Storage::BoolResponse response) const { diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp index 4171af04437..d7aea012af4 100644 --- a/backends/cloud/dropbox/dropboxstorage.cpp +++ b/backends/cloud/dropbox/dropboxstorage.cpp @@ -135,7 +135,7 @@ Networking::Request *DropboxStorage::streamFileById(Common::String path, Network Networking::NetworkReadStreamResponse response = request->execute(); if (callback) (*callback)(response); - return response.request; + return response.request; // no leak here, response.request == request } Networking::Request *DropboxStorage::createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) { diff --git a/backends/cloud/dropbox/dropboxuploadrequest.cpp b/backends/cloud/dropbox/dropboxuploadrequest.cpp index a3d7dd0d6d6..ee6f6656659 100644 --- a/backends/cloud/dropbox/dropboxuploadrequest.cpp +++ b/backends/cloud/dropbox/dropboxuploadrequest.cpp @@ -137,10 +137,10 @@ void DropboxUploadRequest::partUploadedCallback(Networking::JsonResponse respons //debug("%s", json->stringify(true).c_str()); if (object.contains("error") || object.contains("error_summary")) { - warning("Dropbox returned error: %s", object.getVal("error_summary")->asString().c_str()); - delete json; + warning("Dropbox returned error: %s", object.getVal("error_summary")->asString().c_str()); error.response = json->stringify(true); finishError(error); + delete json; return; } diff --git a/backends/cloud/googledrive/googledriveuploadrequest.cpp b/backends/cloud/googledrive/googledriveuploadrequest.cpp index 73a7fbfcaca..dfff46c0d26 100644 --- a/backends/cloud/googledrive/googledriveuploadrequest.cpp +++ b/backends/cloud/googledrive/googledriveuploadrequest.cpp @@ -266,9 +266,9 @@ void GoogleDriveUploadRequest::partUploadedCallback(Networking::JsonResponse res if (object.contains("error")) { warning("GoogleDrive returned error: %s", json->stringify(true).c_str()); - delete json; error.response = json->stringify(true); finishError(error); + delete json; return; } diff --git a/backends/cloud/onedrive/onedriveuploadrequest.cpp b/backends/cloud/onedrive/onedriveuploadrequest.cpp index 5b86c6c9883..500f875b9d5 100644 --- a/backends/cloud/onedrive/onedriveuploadrequest.cpp +++ b/backends/cloud/onedrive/onedriveuploadrequest.cpp @@ -127,9 +127,9 @@ void OneDriveUploadRequest::partUploadedCallback(Networking::JsonResponse respon if (object.contains("error")) { warning("OneDrive returned error: %s", json->stringify(true).c_str()); - delete json; error.response = json->stringify(true); finishError(error); + delete json; return; }