[vlc-devel] [PATCH 2/2] flac: fix memory leak
le.businessman at gmail.com
Mon Sep 1 21:41:50 CEST 2014
On Fri, Aug 29, 2014 at 12:26 PM, Hannes Domani <ssbssa at yahoo.de> wrote:
> I'm not sure if this one is completely correct.
> In this case p_sys->p_block was allocated by block_Alloc() inside ProcessHeader().
> But I don't see when this new block is actually used, because it's overwritten immediately after ProcessHeader().
> Can somebody please have a look at this?
The new block is used inside ProcessHeader() (although it's not very
obvious). FLAC__stream_decoder_process_until_end_of_metadata, invoked
at the end of ProcessHeader(), eventually calls DecoderReadCallback,
which uses the block. So you can free it immediately after that call.
I would suggest moving this block_Release there (at the end of
ProcessHeader) to make the connection clearer.
Also note that the calls to block_Alloc in ProcessHeader() are not
verified at the moment (they may return NULL), but that could be done
in a separate patch.
More information about the vlc-devel