[FFmpeg-devel] [PATCH] Avoid crash if avformat_open_input fails due to ic being NULL.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Aug 23 19:40:08 CEST 2011


This updates the code to match current master.
Should fix trac issue #410.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavformat/utils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3242887..662b49a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -537,7 +537,8 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
     else
         ic->pb = pb;
 
-    err = avformat_open_input(&ic, filename, fmt, &opts);
+    if ((err = avformat_open_input(&ic, filename, fmt, &opts)) < 0)
+        goto fail;
 
     *ic_ptr = ic;
     ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set above
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list