[FFmpeg-cvslog] ffprobe: change order of operations in probe_file()

Stefano Sabatini git at videolan.org
Wed Jan 4 01:09:18 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Thu Dec 29 12:50:25 2011 +0100| [90347dabc8a41c03e4d282c301de917cd9b9e21b] | committer: Stefano Sabatini

ffprobe: change order of operations in probe_file()

This is required by a pending patch, also fixes a memleak due to the
writer context not being closed in case of open_input_file() failure.

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

 ffprobe.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index ddeaeee..42832d7 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1399,16 +1399,16 @@ static int probe_file(const char *filename)
 
     if ((ret = writer_open(&wctx, w, w_args, NULL)) < 0)
         goto end;
-    if ((ret = open_input_file(&fmt_ctx, filename)))
-        goto end;
 
     writer_print_header(wctx);
+    ret = open_input_file(&fmt_ctx, filename);
+    if (ret >= 0) {
     PRINT_CHAPTER(packets);
     PRINT_CHAPTER(streams);
     PRINT_CHAPTER(format);
-    writer_print_footer(wctx);
-
     avformat_close_input(&fmt_ctx);
+    }
+    writer_print_footer(wctx);
     writer_close(&wctx);
 
 end:



More information about the ffmpeg-cvslog mailing list