[FFmpeg-cvslog] lavf: allow avformat_close_input() with NULL

wm4 git at videolan.org
Wed Nov 8 18:40:36 EET 2017


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Sun Jul 16 12:43:09 2017 +0200| [2b1324bd167553f49736e4eaa94f96da9982925e] | committer: Anton Khirnov

lavf: allow avformat_close_input() with NULL

This is consistent with how other destructors behave.

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b1324bd167553f49736e4eaa94f96da9982925e
---

 libavformat/utils.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index eaba473914..bbdc2cdb8a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2733,7 +2733,12 @@ void avformat_free_context(AVFormatContext *s)
 void avformat_close_input(AVFormatContext **ps)
 {
     AVFormatContext *s = *ps;
-    AVIOContext *pb    = s->pb;
+    AVIOContext *pb;
+
+    if (!*ps)
+        return;
+
+    pb = s->pb;
 
     if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
         (s->flags & AVFMT_FLAG_CUSTOM_IO))



More information about the ffmpeg-cvslog mailing list