Menu

#47 Fixes memory leak when reinitializing stream encoder

1.3.0
closed-fixed
nobody
None
5
2014-11-15
2011-08-11
bepaald
No

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

Discussion

  • bepaald

    bepaald - 2011-08-11

    Patch to fix memory leak when reinitializing stream encoder

     
  • Erik

    Erik - 2014-11-15
    • status: open --> closed-fixed
    • Group: --> 1.3.0
     
  • Erik

    Erik - 2014-11-15

    This patch has already been applied.

     

Log in to post a comment.