[vlc-devel] [PATCH] Fix double free in stream deletion
Awais Chishti
chishtiawais511 at gmail.com
Wed Mar 20 10:01:11 CET 2019
Thought so, but tried to keep it the same way as was already done. Should I rewrite the patch, and do you think the workaround should be removed from transcode_audio_clean() too? Wednesday, 20 March 2019, 01:51PM +05:00 from Steve Lhomme robux4 at ycbcr.xyz :
>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
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190320/1a472617/attachment.html>
More information about the vlc-devel
mailing list