From 199db97fbdd92c58b8f0e50eac60fead35e4dc57 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 8 Mar 2013 02:46:46 +0100 Subject: [PATCH] Close output codecs if input codec initialisation fails. Fixes ticket #1546 and the remaining part of ticket #1244. --- ffmpeg.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index c88665e500..2ea3694394 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++) { -- 2.11.0