diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-12-11 21:58:45 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-12-11 23:59:30 +0200 |
commit | 779e33be5d394347ddf1d30dfde4e5621fe40578 (patch) | |
tree | 14f971004a80b12d2417cc7e826f772fdfa8e7f0 | |
parent | b75081cc592df6ec074b1a5cf5e5b1c8c62a8780 (diff) | |
download | subsurface-779e33be5d394347ddf1d30dfde4e5621fe40578.tar.gz |
Cleanup: don't leak filename on picture creation
dive_create_picture() is called from DiveListView::matchImagesToDives()
with a copy of the picture-filename. But:
- On error the filename is not freed
- On success the filename is strdup()ed
Thus, in all cases the memory is lost. Instead, pass in a temporary
buffer using qPrintable().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | desktop-widgets/divelistview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 9167bea5e..804bf9b9b 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -975,7 +975,7 @@ void DiveListView::matchImagesToDives(QStringList fileNames) for_each_dive (j, dive) { if (!dive->selected) continue; - dive_create_picture(dive, copy_qstring(fileName), shiftDialog.amount(), shiftDialog.matchAll()); + dive_create_picture(dive, qPrintable(fileName), shiftDialog.amount(), shiftDialog.matchAll()); } } |