When verification is enable on a stream_encoder (by FLAC__stream_encoder_set_verify(true)), initializing the encoder will also create a new decoder (used for verification). When the stream is reinitialized later (after having called FLAC__stream_encoder_finish()), a new decoder wil be allocated, without the old one being deleted. Because of this more memory is leaked each time a stream is reinitialized. The call to FLAC__stream_encoder_finish(), will leave the decoder in an uninitialized state ready to be initialized again without having to create a new one.
For a longer explanation and example code, see the following thread on the flac-dev mailing list: http://lists.xiph.org/pipermail/flac-dev/2011-August/003002.html
Attached is a patch (against current CVS) that fixes this leak, by checking that a decoder is not already created before creating a new one.
thanks,
Bas Timmer
Patch to fix memory leak when reinitializing stream encoder
This patch has already been applied.