[vlc-devel] [PATCH] Fix double free in stream deletion

Steve Lhomme robux4 at ycbcr.xyz
Wed Mar 20 11:33:40 CET 2019


LGTM

On 3/20/2019 11:08 AM, chishtiawais511 at gmail.com wrote:
> From: Awais Chishti <chishtiawais511 at gmail.com>
>
> Decoder cleaning is being done with module_unneed() once in transcode.c:697 and sometimes in the preceeding switch statement causing VLC to crash. Either avoid cleaning the decoder in DeleteSoutStreamID() or in the transcode_*() functions. The patch does the latter as suggested earlier.
> ---
>   modules/stream_out/transcode/audio.c | 9 ---------
>   modules/stream_out/transcode/spu.c   | 5 -----
>   modules/stream_out/transcode/video.c | 6 ------
>   3 files changed, 20 deletions(-)
>
> diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
> index dd8dac3908..bf1b5d772d 100644
> --- a/modules/stream_out/transcode/audio.c
> +++ b/modules/stream_out/transcode/audio.c
> @@ -201,15 +201,6 @@ int transcode_audio_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
>   
>   void transcode_audio_clean( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
>   {
> -    /* Close decoder */
> -    if( id->p_decoder->p_module )
> -        module_unneed( id->p_decoder, id->p_decoder->p_module );
> -    id->p_decoder->p_module = NULL;
> -
> -    if( id->p_decoder->p_description )
> -        vlc_meta_Delete( id->p_decoder->p_description );
> -    id->p_decoder->p_description = NULL;
> -
>       /* Close encoder */
>       transcode_encoder_close( id->encoder );
>       transcode_encoder_delete( id->encoder );
> diff --git a/modules/stream_out/transcode/spu.c b/modules/stream_out/transcode/spu.c
> index b491774241..83426d1d69 100644
> --- a/modules/stream_out/transcode/spu.c
> +++ b/modules/stream_out/transcode/spu.c
> @@ -159,11 +159,6 @@ int transcode_spu_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
>   void transcode_spu_clean( sout_stream_t *p_stream, sout_stream_id_sys_t *id)
>   {
>       VLC_UNUSED(p_stream);
> -    /* Close decoder */
> -    if( id->p_decoder->p_module )
> -        module_unneed( id->p_decoder, id->p_decoder->p_module );
> -    if( id->p_decoder->p_description )
> -        vlc_meta_Delete( id->p_decoder->p_description );
>   
>       /* Close encoder */
>       if( id->encoder )
> diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
> index 24556e1b2d..ef64cf7539 100644
> --- a/modules/stream_out/transcode/video.c
> +++ b/modules/stream_out/transcode/video.c
> @@ -310,12 +310,6 @@ void transcode_video_clean( sout_stream_t *p_stream,
>   {
>       VLC_UNUSED(p_stream);
>   
> -    /* Close decoder */
> -    if( id->p_decoder->p_module )
> -        module_unneed( id->p_decoder, id->p_decoder->p_module );
> -    if( id->p_decoder->p_description )
> -        vlc_meta_Delete( id->p_decoder->p_description );
> -
>       /* Close encoder */
>       transcode_encoder_close( id->encoder );
>       transcode_encoder_delete( id->encoder );
> -- 
> 2.21.0
>
> _______________________________________________
> 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