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

Steve Lhomme robux4 at ycbcr.xyz
Wed Mar 20 09:51:11 CET 2019


Hi,

I think the proper way would be to let DeleteSoutStreamID() do the 
decoder cleaning and not to it in transcode_*_clean() at all.

On 3/19/2019 9:59 PM, chishtiawais511 at gmail.com wrote:
> From: Awais Chishti <chishtiawais511 at gmail.com>
>
> The function Del() in modules/stream_out/transcode/transcode.c is calling module_unneed() once in the transcode_*_clean() functions and then again in the last DeleteSoutStreamID() call after which VLC crashes. It seems that a workaround is implemented in only transcode_audio_clean(), which the patch repeats for the remaining transcode_*_clean() functions.
> ---
>   modules/stream_out/transcode/spu.c   | 4 ++++
>   modules/stream_out/transcode/video.c | 3 +++
>   2 files changed, 7 insertions(+)
>
> diff --git a/modules/stream_out/transcode/spu.c b/modules/stream_out/transcode/spu.c
> index b491774241..d201af99f1 100644
> --- a/modules/stream_out/transcode/spu.c
> +++ b/modules/stream_out/transcode/spu.c
> @@ -159,11 +159,15 @@ 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 );
> +    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 */
>       if( id->encoder )
> diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
> index 24556e1b2d..7ebc9436d8 100644
> --- a/modules/stream_out/transcode/video.c
> +++ b/modules/stream_out/transcode/video.c
> @@ -313,8 +313,11 @@ void transcode_video_clean( sout_stream_t *p_stream,
>       /* 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 );
> -- 
> 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