[FFmpeg-cvslog] Prevent segfault if iformat was not yet initialized.

Panagiotis H.M. Issaris git at videolan.org
Wed Dec 14 17:34:40 CET 2011


ffmpeg | branch: master | Panagiotis H.M. Issaris <takis.issaris at uhasselt.be> | Wed Dec 14 17:15:53 2011 +0100| [9b01a8ad5ecf88aa0a8e52c2b70816e03ef59162] | committer: Michael Niedermayer

Prevent segfault if iformat was not yet initialized.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/utils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d847496..9fef520 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2809,10 +2809,10 @@ void av_close_input_file(AVFormatContext *s)
 void avformat_close_input(AVFormatContext **ps)
 {
     AVFormatContext *s = *ps;
-    AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
+    AVIOContext *pb = (s->iformat && (s->iformat->flags & AVFMT_NOFILE)) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
                        NULL : s->pb;
     flush_packet_queue(s);
-    if (s->iformat->read_close)
+    if (s->iformat && (s->iformat->read_close))
         s->iformat->read_close(s);
     avformat_free_context(s);
     *ps = NULL;



More information about the ffmpeg-cvslog mailing list