[vlc-devel] [PATCH 2/2] flac: fix memory leak

Tristan Matthews le.businessman at gmail.com
Tue Sep 2 20:25:07 CEST 2014


On Tue, Sep 2, 2014 at 12:49 PM, Hannes Domani <ssbssa at yahoo.de> wrote:
>> Tristan Matthews <le.businessman at gmail.com> schrieb am 21:41 Montag, 1.September 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.
>
> Here the new patch.
>
>> 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.
>
> It's the next one.

Both merged, thanks.

Best,
Tristan



More information about the vlc-devel mailing list