From 779e33be5d394347ddf1d30dfde4e5621fe40578 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 11 Dec 2018 21:58:45 +0100 Subject: 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 --- desktop-widgets/divelistview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop-widgets/divelistview.cpp') 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()); } } -- cgit v1.2.3-70-g09d2