From ab1013f2799fdff84fe448714605e6fd05ac36a9 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 19 Sep 2021 17:57:10 +0300 Subject: [PATCH] plug QTextCodec memory leaks Signed-off-by: Ivailo Monev --- scripts/lsan.supp | 4 +--- src/core/codecs/qtextcodec.cpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/lsan.supp b/scripts/lsan.supp index 880d6d9f1..1147412fe 100644 --- a/scripts/lsan.supp +++ b/scripts/lsan.supp @@ -1,3 +1 @@ -leak:libfontconfig.so -leak:Katie::QTextCodec::codecForName -leak:Katie::QTextCodec::codecForMib \ No newline at end of file +leak:libfontconfig.so \ No newline at end of file diff --git a/src/core/codecs/qtextcodec.cpp b/src/core/codecs/qtextcodec.cpp index db8747eee..d02d6487d 100644 --- a/src/core/codecs/qtextcodec.cpp +++ b/src/core/codecs/qtextcodec.cpp @@ -83,8 +83,8 @@ public: */ QTextCodecCleanup::~QTextCodecCleanup() { - for (int i = 0; i < this->size(); i++) { - delete this->at(i); + while (begin() != end()) { + delete *begin(); } localeMapper = nullptr; #ifndef QT_NO_DEBUG