[vlc-devel] [vlc-commits] demux: adaptive: missing es_format_Init

Steve Lhomme robux4 at gmail.com
Tue Aug 29 13:26:34 CEST 2017


On Tue, Aug 29, 2017 at 11:59 AM, Francois Cartegnie <fcvlcdev at free.fr> wrote:
> Le 29/08/2017 à 11:51, Steve Lhomme a écrit :
>
>>>  FakeESOutID * FakeESOut::createNewID( const es_format_t *p_fmt )
>>>  {
>>>      es_format_t fmtcopy;
>>> +    es_format_Init( &fmtcopy, p_fmt->i_cat, p_fmt->i_codec );
>>
>> This is unneeded and has no effect. Copy() overwrites an uninitialized
>> es_format. If it's initialized it might actually leak dynamic that are
>> stored in it.
>>
>
> I give up explaining again why Copy shouldn't be used for init.

This is just what the code does and assumes everywhere. It's just doing a = b;
If you want a to be initialized you can call Clean() in Copy(). But
you'll have some weird behavior because in many cases that memory is
actually uninitialized and you'll end up freeing memory pointing to
nowhere.

> --
> Francois Cartegnie
> VideoLAN - VLC Developer
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list