diff mbox series

[FFmpeg-devel,37/39] doc/examples/extract_mvs: Explicitly free options

Message ID HE1PR0301MB2154333837356A3A5C98FA7E8F299@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 3a5412b39eeb2f7af66acc985b55ccdb8bb9a953
Headers show
Series [FFmpeg-devel,01/39] avcodec/audiotoolboxenc: Remove AV_CODEC_CAP_DR1 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Andreas Rheinhardt May 21, 2021, 9:17 a.m. UTC
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>
---
 doc/examples/extract_mvs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index 42e1844150..f5d2fd9179 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -104,7 +104,9 @@  static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
 
         /* Init the video decoder */
         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",
                     av_get_media_type_string(type));
             return ret;