Skip to content

Commit

Permalink
Fix memory leak.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <blackslayer4@gmail.com>
  • Loading branch information
allexzander committed Mar 2, 2023
1 parent 501801b commit e3f5147
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libsync/updatefiledropmetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ void UpdateFileDropMetadataJob::slotFolderEncryptedMetadataReceived(const QJsonD
qCDebug(lcUpdateFileDropMetadataJob) << "Metadata Received, Preparing it for the new file." << json.toVariant();

// Encrypt File!
_metadata = new FolderMetadata(propagator()->account(), json.toJson(QJsonDocument::Compact), statusCode);
_metadata.reset(new FolderMetadata(propagator()->account(), json.toJson(QJsonDocument::Compact), statusCode));
if (!_metadata->moveFileDropToFiles()) {
unlockFolder();
return;
}

emit fileDropMetadataParsedAndAdjusted(_metadata);
emit fileDropMetadataParsedAndAdjusted(_metadata.data());

const auto updateMetadataJob = new UpdateMetadataApiJob(propagator()->account(), _folderId, _metadata->encryptedMetadata(), _folderToken);
connect(updateMetadataJob, &UpdateMetadataApiJob::success, this, &UpdateFileDropMetadataJob::slotUpdateMetadataSuccess);
Expand Down
4 changes: 3 additions & 1 deletion src/libsync/updatefiledropmetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "owncloudpropagator.h"

#include <QScopedPointer>

class QNetworkReply;

namespace OCC {
Expand Down Expand Up @@ -61,7 +63,7 @@ private slots:
QByteArray _folderToken;
QByteArray _folderId;

FolderMetadata *_metadata = nullptr;
QScopedPointer<FolderMetadata> _metadata;
};

}

0 comments on commit e3f5147

Please sign in to comment.