[vlc-devel] [PATCH 2/2] sout: description: make the ownership of es_format clear

Francois Cartegnie fcvlcdev at free.fr
Mon Oct 1 20:44:11 CEST 2018

Le 01/10/2018 à 13:11, Zhao Zhili a écrit :

>> Only the NOTE is incorrect and the Del() must free the opaque, being
>> here a fmt copy.
> Del() is called during input_Close(), but those es_format associated with sout-description-data are used after input_Close(). So if there is a single copy and Del() free those es_format, it leads to use-after-free.
> If you think two copies are not right, any other suggestion?
> vlm.c:
>                 var_Create( p_input, "sout-description-data", VLC_VAR_ADDRESS );
>                 var_SetAddress( p_input, "sout-description-data", &data );
>                 if( !input_Start( p_input ) )
>                     vlc_sem_wait( &sem_preparse );
>                 var_DelCallback( p_input, "intf-event", InputEventPreparse,
>                                  &preparse );
>                 input_Stop( p_input );
>                 input_Close( p_input );

Sounds like a hackish module :/

But if the only purpose of description as sout module is to feed the
parent variable, then the Add can return NULL, that's unused. No local
data storage required.

Francois Cartegnie
VideoLAN - VLC Developer

More information about the vlc-devel mailing list