summaryrefslogtreecommitdiffstats
path: root/core/imagedownloader.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-02-08 22:05:29 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-03-05 18:04:57 +0200
commitc1cd2e0f0295c569644c6d5ff186e00b4ce82d30 (patch)
tree1454513d8c5b56e12127c74c275ad1828a274861 /core/imagedownloader.cpp
parent93ddcce6fad7912af579acb6a0697d3574dd35b3 (diff)
downloadsubsurface-c1cd2e0f0295c569644c6d5ff186e00b4ce82d30.tar.gz
core/imagedownloader.cpp: Fix memory leak
A cloned picture struct would not be freed if the filename was already in the queued-for-download set. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/imagedownloader.cpp')
-rw-r--r--core/imagedownloader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/imagedownloader.cpp b/core/imagedownloader.cpp
index 05900c40d..cdaa7fc90 100644
--- a/core/imagedownloader.cpp
+++ b/core/imagedownloader.cpp
@@ -86,8 +86,10 @@ static void loadPicture(struct picture *picture, bool fromHash)
if (!picture)
return;
QMutexLocker locker(&pictureQueueMutex);
- if (queuedPictures.contains(QString(picture->filename)))
+ if (queuedPictures.contains(QString(picture->filename))) {
+ picture_free(picture);
return;
+ }
queuedPictures.insert(QString(picture->filename));
locker.unlock();