doc/examples/extract_mvs: Explicitly free options

The user should not rely on all options always being recognized
(in particular not on error).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-05-15 08:27:45 +02:00
parent 933308a290
commit 3a5412b39e
1 changed files with 3 additions and 1 deletions

View File

@ -104,7 +104,9 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
/* Init the video decoder */ /* Init the video decoder */
av_dict_set(&opts, "flags2", "+export_mvs", 0); av_dict_set(&opts, "flags2", "+export_mvs", 0);
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) { ret = avcodec_open2(dec_ctx, dec, &opts);
av_dict_free(&opts);
if (ret < 0) {
fprintf(stderr, "Failed to open %s codec\n", fprintf(stderr, "Failed to open %s codec\n",
av_get_media_type_string(type)); av_get_media_type_string(type));
return ret; return ret;