[FFmpeg-cvslog] Close output codecs if input codec initialisation fails.

Carl Eugen Hoyos git at videolan.org
Fri Mar 8 03:40:24 CET 2013


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Fri Mar  8 02:46:46 2013 +0100| [199db97fbdd92c58b8f0e50eac60fead35e4dc57] | committer: Carl Eugen Hoyos

Close output codecs if input codec initialisation fails.

Fixes ticket #1546 and the remaining part of ticket #1244.

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

 ffmpeg.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index c88665e..2ea3694 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2444,8 +2444,13 @@ static int transcode_init(void)
 
     /* init input streams */
     for (i = 0; i < nb_input_streams; i++)
-        if ((ret = init_input_stream(i, error, sizeof(error))) < 0)
+        if ((ret = init_input_stream(i, error, sizeof(error))) < 0) {
+            for (i = 0; i < nb_output_streams; i++) {
+                ost = output_streams[i];
+                avcodec_close(ost->st->codec);
+            }
             goto dump_format;
+        }
 
     /* discard unused programs */
     for (i = 0; i < nb_input_files; i++) {



More information about the ffmpeg-cvslog mailing list