aboutsummaryrefslogtreecommitdiffstats
path: root/ffprobe.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2012-02-18 21:34:44 +0100
committerClément Bœsch <ubitux@gmail.com>2012-02-18 21:35:09 +0100
commit8688e6acba81c411c645a1f07f4ca18502726ded (patch)
tree3ed396690c4de46e3a504dea4c8bfae9d7dbd9ee /ffprobe.c
parentf23a740303e0ae54f2dac936188475b9a9c761fc (diff)
downloadffmpeg-8688e6acba81c411c645a1f07f4ca18502726ded.tar.gz
ffprobe: fix crash if the file can't be opened.
Diffstat (limited to 'ffprobe.c')
-rw-r--r--ffprobe.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/ffprobe.c b/ffprobe.c
index a2315d55c7..f4174fae5e 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1627,9 +1627,9 @@ static int probe_file(WriterContext *wctx, const char *filename)
do_read_packets = do_show_packets || do_count_packets;
ret = open_input_file(&fmt_ctx, filename);
- nb_streams_frames = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_frames));
- nb_streams_packets = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_packets));
if (ret >= 0) {
+ nb_streams_frames = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_frames));
+ nb_streams_packets = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_packets));
if (do_read_frames || do_read_packets) {
const char *chapter;
if (do_show_frames && do_show_packets &&
@@ -1651,11 +1651,9 @@ static int probe_file(WriterContext *wctx, const char *filename)
if (fmt_ctx->streams[i]->codec->codec_id != CODEC_ID_NONE)
avcodec_close(fmt_ctx->streams[i]->codec);
avformat_close_input(&fmt_ctx);
+ av_freep(&nb_streams_frames);
+ av_freep(&nb_streams_packets);
}
-
- av_freep(&nb_streams_frames);
- av_freep(&nb_streams_packets);
-
return ret;
}