diff mbox series

[FFmpeg-devel,24/38] avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible

Message ID AM7PR03MB666063CEA81AEEF8EBAD7D7D8FD89@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,01/39] avfilter/vf_maskedminmax: Simplify init | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 12, 2021, 10:53 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/avfilter.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 11d4e01807..cc499fd5ed 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -822,6 +822,7 @@  static int process_options(AVFilterContext *ctx, AVDictionary **options,
 
     while (*args) {
         const char *shorthand = NULL;
+        int flags = AV_DICT_DONT_STRDUP_VAL;
 
         o = av_opt_next(ctx->priv, o);
         if (o) {
@@ -846,6 +847,7 @@  static int process_options(AVFilterContext *ctx, AVDictionary **options,
             args++;
         if (parsed_key) {
             key = parsed_key;
+            flags |= AV_DICT_DONT_STRDUP_KEY;
             while ((o = av_opt_next(ctx->priv, o))); /* discard all remaining shorthand */
         } else {
             key = shorthand;
@@ -853,10 +855,7 @@  static int process_options(AVFilterContext *ctx, AVDictionary **options,
 
         av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value);
 
-            av_dict_set(options, key, value, 0);
-
-        av_free(value);
-        av_free(parsed_key);
+        av_dict_set(options, key, value, flags);
     }
 
     return 0;