From 3f11e0ae2fd84f79dc8c4d4fdd90c0218e309666 Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Fri, 1 Dec 2023 07:49:11 +0100 Subject: [PATCH] TestId3v2FrameFactory: Fix memory leak The frames in a frameList() copy were not deleted because it had the autoDelete property active. However, removed frames cannot be auto deleted. Using setAutoDelete() affects the source of the copy, which has to be investigated further. --- tests/test_id3v2framefactory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_id3v2framefactory.cpp b/tests/test_id3v2framefactory.cpp index b3e98547..d33661ff 100644 --- a/tests/test_id3v2framefactory.cpp +++ b/tests/test_id3v2framefactory.cpp @@ -131,9 +131,9 @@ public: auto f = std::unique_ptr(createFileWithDefaultFactory(fileName)); CPPUNIT_ASSERT(f->isValid()); ID3v2::Tag *tag = getID3v2Tag(*f); - const ID3v2::FrameList frames = tag->frameList(); - for(const auto &frame : frames) { - tag->removeFrame(frame, false); + ID3v2::FrameList frames = tag->frameList(); + for(auto it = frames.begin(); it != frames.end(); it = frames.erase(it)) { + tag->removeFrame(*it); } tag->setArtist("An artist"); tag->setTitle("A title");