[vlc-devel] [PATCH v3 1/2] demux: avformat: initialize i_tracks to zero

Steve Lhomme robux4 at ycbcr.xyz
Mon Jan 11 06:50:56 UTC 2021


I guess it's cleaner but the value is never used if tracks is not NULL. 
It's only temporarily unset if there is an error before tracks is 
allocated. Even then it's not used.

IMO a better cleaning would be to use i_tracks instead of the temporary 
nb_streams variable, which in the end is the same thing.

On 2021-01-04 14:11, Zhao Zhili wrote:
> So we can use it in CloseDemux() in error path.
> ---
>   modules/demux/avformat/demux.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
> index 4a765b7352..73327cbcc5 100644
> --- a/modules/demux/avformat/demux.c
> +++ b/modules/demux/avformat/demux.c
> @@ -341,6 +341,7 @@ int avformat_OpenDemux( vlc_object_t *p_this )
>       p_sys->ic = 0;
>       p_sys->fmt = fmt;
>       p_sys->tracks = NULL;
> +    p_sys->i_tracks = 0;
>       p_sys->i_ssa_order = 0;
>       TAB_INIT( p_sys->i_attachments, p_sys->attachments);
>       p_sys->p_title = NULL;
> -- 
> 2.25.1
> 
> _______________________________________________
> 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