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

Submitted by Steven Liu on Nov. 29, 2019, 5:56 a.m.

Details

Message ID 20191129055632.30294-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Nov. 29, 2019, 5:56 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/utils.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andreas Rheinhardt Nov. 29, 2019, 5:59 a.m.
Steven Liu:
> Signed-off-by: Steven Liu <lq@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

Patch hide | download patch | download mbox

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)