From d0ccbac6c040dd2c5d4b1a76e9ecfa830809384d6817dc70fdbe3501cfd32a17 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Sat, 2 Jan 2021 16:15:31 +0000 Subject: [PATCH] Accepting request 859844 from home:Vogtinator:branches:KDE:Applications - Add patches to fix issues reported by valgrind (boo#1180352): * 0001-Initialize-Transfer-m_runningSeconds.patch * 0002-Don-t-create-dangling-iterators-in-TransferMultiSegK.patch- OBS-URL: https://build.opensuse.org/request/show/859844 OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/kget?expand=0&rev=135 --- ...Initialize-Transfer-m_runningSeconds.patch | 23 ++++++++++++++ ...gling-iterators-in-TransferMultiSegK.patch | 30 +++++++++++++++++++ kget.changes | 7 +++++ kget.spec | 5 +++- 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0001-Initialize-Transfer-m_runningSeconds.patch create mode 100644 0002-Don-t-create-dangling-iterators-in-TransferMultiSegK.patch diff --git a/0001-Initialize-Transfer-m_runningSeconds.patch b/0001-Initialize-Transfer-m_runningSeconds.patch new file mode 100644 index 0000000..1a394fe --- /dev/null +++ b/0001-Initialize-Transfer-m_runningSeconds.patch @@ -0,0 +1,23 @@ +From 21fe11c2d0be6d135d3ffe87e925ae7eeea7f653 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 30 Dec 2020 17:16:49 +0100 +Subject: [PATCH 1/2] Initialize Transfer::m_runningSeconds + +Valgrind complained about that. +--- + core/transfer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: kget-20.12.0/core/transfer.cpp +=================================================================== +--- kget-20.12.0.orig/core/transfer.cpp ++++ kget-20.12.0/core/transfer.cpp +@@ -49,7 +49,7 @@ Transfer::Transfer(TransferGroup * paren + m_percent(0), m_downloadSpeed(0), m_uploadSpeed(0), + m_uploadLimit(0), m_downloadLimit(0), m_isSelected(false), + m_capabilities(0), m_visibleUploadLimit(0), m_visibleDownloadLimit(0), +- m_ratio(0), m_handler(nullptr), m_factory(factory) ++ m_runningSeconds(0), m_ratio(0), m_handler(nullptr), m_factory(factory) + { + Q_UNUSED(e) + } diff --git a/0002-Don-t-create-dangling-iterators-in-TransferMultiSegK.patch b/0002-Don-t-create-dangling-iterators-in-TransferMultiSegK.patch new file mode 100644 index 0000000..9ac08d4 --- /dev/null +++ b/0002-Don-t-create-dangling-iterators-in-TransferMultiSegK.patch @@ -0,0 +1,30 @@ +From 7cb5edab11bcf99788451b00994854d175386781 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Wed, 30 Dec 2020 17:17:25 +0100 +Subject: [PATCH 2/2] Don't create dangling iterators in TransferMultiSegKio + +m_dataSourceFactory->mirrors() returns a value, which is destroyed after the +assignment, but the iterators still point to it. +--- + transfer-plugins/multisegmentkio/transfermultisegkio.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp +index 5b5d898b..87b74148 100644 +--- a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp ++++ b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp +@@ -182,8 +182,9 @@ void TransferMultiSegKio::slotDataSourceFactoryChange(Transfer::ChangesFlags cha + } + if (change & Tc_Source) { + m_source = QUrl(); +- QHash< QUrl, QPair >::const_iterator it = m_dataSourceFactory->mirrors().constBegin(); +- QHash< QUrl, QPair >::const_iterator end = m_dataSourceFactory->mirrors().constEnd(); ++ QHash< QUrl, QPair > mirrors = m_dataSourceFactory->mirrors(); ++ QHash< QUrl, QPair >::const_iterator it = mirrors.constBegin(); ++ QHash< QUrl, QPair >::const_iterator end = mirrors.constEnd(); + for (; it != end; it++) { + if (it.value().first) { + m_source = it.key(); +-- +2.25.1 + diff --git a/kget.changes b/kget.changes index 047ca19..7edd336 100644 --- a/kget.changes +++ b/kget.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Jan 2 14:52:43 UTC 2021 - Fabian Vogt + +- Add patches to fix issues reported by valgrind (boo#1180352): + * 0001-Initialize-Transfer-m_runningSeconds.patch + * 0002-Don-t-create-dangling-iterators-in-TransferMultiSegK.patch- + ------------------------------------------------------------------- Sat Dec 5 23:16:16 UTC 2020 - Luca Beltrame diff --git a/kget.spec b/kget.spec index 9647dba..5d18389 100644 --- a/kget.spec +++ b/kget.spec @@ -27,6 +27,9 @@ Summary: Download Manager License: GPL-2.0-or-later Group: Productivity/Networking/Other Source: https://download.kde.org/stable/release-service/%{version}/src/%{name}-%{version}.tar.xz +# PATCH-FIX-UPSTREAM +Patch1: 0001-Initialize-Transfer-m_runningSeconds.patch +Patch2: 0002-Don-t-create-dangling-iterators-in-TransferMultiSegK.patch BuildRequires: extra-cmake-modules BuildRequires: gpgme-devel BuildRequires: libboost_headers-devel @@ -72,7 +75,7 @@ An advanced download manager by KDE %lang_package %prep -%setup -q +%autosetup -p1 %build %cmake_kf5 -d build