Unified · Split
| @@ -2398,6 +2398,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) · 2397 unmodified lines | ||
| 2398 | 2398 | print_error(filename, err); |
| 2399 | 2399 | return err; |
| 2400 | 2400 | } |
| 2401 | + *fmt_ctx_ptr = fmt_ctx; | |
| 2401 | 2402 | if (scan_all_pmts_set) |
| 2402 | 2403 | av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE); |
| 2403 | 2404 | if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { |
| @@ -2409,14 +2410,17 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) · 5 unmodified lines | ||
| 2409 | 2410 | opts = setup_find_stream_info_opts(fmt_ctx, codec_opts); |
| 2410 | 2411 | orig_nb_streams = fmt_ctx->nb_streams; |
| 2411 | 2412 | |
| 2412 | − if ((err = avformat_find_stream_info(fmt_ctx, opts)) < 0) { | |
| 2413 | − print_error(filename, err); | |
| 2414 | − return err; | |
| 2415 | − } | |
| 2413 | + err = avformat_find_stream_info(fmt_ctx, opts); | |
| 2414 | + | |
| 2416 | 2415 | for (i = 0; i < orig_nb_streams; i++) |
| 2417 | 2416 | av_dict_free(&opts[i]); |
| 2418 | 2417 | av_freep(&opts); |
| 2419 | 2418 | |
| 2419 | + if (err < 0) { | |
| 2420 | + print_error(filename, err); | |
| 2421 | + return err; | |
| 2422 | + } | |
| 2423 | + | |
| 2420 | 2424 | av_dump_format(fmt_ctx, 0, filename, 0); |
| 2421 | 2425 | |
| 2422 | 2426 | /* bind a decoder to each input stream */ |
| @@ -2466,7 +2470,7 @@ static void close_input_file(AVFormatContext **ctx_ptr) · 43 unmodified lines | ||
| 2466 | 2470 | |
| 2467 | 2471 | static int probe_file(WriterContext *wctx, const char *filename) |
| 2468 | 2472 | { |
| 2469 | − AVFormatContext *fmt_ctx; | |
| 2473 | + AVFormatContext *fmt_ctx = NULL; | |
| 2470 | 2474 | int ret, i; |
| 2471 | 2475 | int section_id; |
| 2472 | 2476 | |
| @@ -2475,7 +2479,7 @@ static int probe_file(WriterContext *wctx, const char *filename) · 2 unmodified lines | ||
| 2475 | 2479 | |
| 2476 | 2480 | ret = open_input_file(&fmt_ctx, filename); |
| 2477 | 2481 | if (ret < 0) |
| 2478 | − return ret; | |
| 2482 | + goto end; | |
| 2479 | 2483 | |
| 2480 | 2484 | #define CHECK_END if (ret < 0) goto end |
| 2481 | 2485 | |
| @@ -2533,7 +2537,8 @@ static int probe_file(WriterContext *wctx, const char *filename) · 51 unmodified lines | ||
| 2533 | 2537 | } |
| 2534 | 2538 | |
| 2535 | 2539 | end: |
| 2536 | − close_input_file(&fmt_ctx); | |
| 2540 | + if (fmt_ctx) | |
| 2541 | + close_input_file(&fmt_ctx); | |
| 2537 | 2542 | av_freep(&nb_streams_frames); |
| 2538 | 2543 | av_freep(&nb_streams_packets); |
| 2539 | 2544 | av_freep(&selected_streams); |