[FFmpeg-devel] [PATCH] avformat/utils: set the AVFormatContext to NULL before return from avformat_free_context

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Nov 29 07:59:00 EET 2019


Steven Liu:
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
>  libavformat/utils.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 8196442dd1..0461aa83ec 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4469,6 +4469,7 @@ void avformat_free_context(AVFormatContext *s)
>      av_freep(&s->internal);
>      av_freep(&s->url);
>      av_free(s);
> +    s = NULL;
>  }
>  
>  void avformat_close_input(AVFormatContext **ps)
> 
Absolutely pointless as I have just explained in another mail: This
resets the function's copy of s, a local variable whose lifetime ends
with this function anyway.

- Andreas


More information about the ffmpeg-devel mailing list