Fix memory leaks in the FLAC parsing code

Thanks to Daniel Schaack for reporting these.
This commit is contained in:
Lukáš Lalinský 2011-03-11 10:29:27 +01:00
parent f89c16cd65
commit 5685dd078f

View File

@ -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;