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

Zhao Zhili quinkblack at foxmail.com
Tue Oct 2 08:24:23 CEST 2018


On 10/2/18 2:44 AM, Francois Cartegnie wrote:
> 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.

The return value is used by stream_out for sout_StreamIdSend and 
control. So I think two copies makes the ownership a little clear.




More information about the vlc-devel mailing list