From: Lukáš Lalinský Date: Fri, 11 Mar 2011 09:29:27 +0000 (+0100) Subject: Fix memory leaks in the FLAC parsing code X-Git-Tag: v1.7~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5685dd078f8f84ff7f2cafe59a0141966aab2f5c;p=taglib Fix memory leaks in the FLAC parsing code Thanks to Daniel Schaack for reporting these. --- diff --git a/taglib/flac/flacfile.cpp b/taglib/flac/flacfile.cpp index 6a57f863..c8cc1fb8 100644 --- a/taglib/flac/flacfile.cpp +++ b/taglib/flac/flacfile.cpp @@ -65,13 +65,13 @@ public: hasID3v2(false), hasID3v1(false) { - for(uint i = 0; i < blocks.size(); i++) { - delete blocks[i]; - } } ~FilePrivate() { + for(uint i = 0; i < blocks.size(); i++) { + delete blocks[i]; + } delete properties; } @@ -403,6 +403,7 @@ void FLAC::File::scan() } else { debug("FLAC::File::scan() -- invalid picture found, discarting"); + delete picture; } } @@ -412,6 +413,9 @@ void FLAC::File::scan() if(block->code() != MetadataBlock::Padding) { d->blocks.append(block); } + else { + delete block; + } nextBlockOffset += length + 4;