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>
This commit is contained in:
Berthold Stoeger 2018-12-11 21:58:45 +01:00 committed by Lubomir I. Ivanov
parent b75081cc59
commit 779e33be5d

View file

@ -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());
}
}