[Flac-dev] Memory leak using libflac++

Andy Hawkins andy at gently.org.uk
Fri Jun 10 08:39:41 PDT 2011


Hi all,

I'm the author of flactag, a utility for tagging whole-album FLAC files with
embedded CUE sheets using data from the MusicBrainz servers.

I've recently run it through valgrind, and I'm seeing memory leaks like the
following:

12 bytes in 1 blocks are definitely lost in loss record 1 of 5
at 0x402377E: operator new(unsigned) (vg_replace_malloc.c:224)
by 0x41448A8: FLAC::Metadata::local::construct_block(FLAC__StreamMetadata*)
(in /usr/lib/libFLAC++.so.6.2.0)   by 0x41455D7:
FLAC::Metadata::Iterator::get_block() (in /usr/lib/libFLAC++.so.6.2.0)
by 0x8072CB5: CFlacInfo::Read() (FlacInfo.cc:154)
by 0x8054BF4: CFlacTag::LoadData() (flactag.cc:543)
by 0x8058D45: CFlacTag::CFlacTag(CCommandLine const&) (flactag.cc:134)
by 0x805D4E2: main (flactag.cc:66)

In my code, the offending line is:

m_PictureBlock=(FLAC::Metadata::Picture*)Iterator.get_block();

(m_PictureBlock is a pointer to a FLAC::Metadata::Picture object).

The documentation seems to imply that you don't need to delete the pointer
that is returned here, but the memory leak report seems to contradict that.

Can anyone tell me if I should be deleteing this point? Or is there
something else I should be doing to clean up?

Thanks

Andy



More information about the Flac-dev mailing list