diff --git a/libavutil/dict.c b/libavutil/dict.c index f7aa7094ad..358958cdc5 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -76,8 +76,11 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, m = *pm = av_mallocz(sizeof(*m)); if (tag) { - if (flags & AV_DICT_DONT_OVERWRITE) + if (flags & AV_DICT_DONT_OVERWRITE) { + if (flags & AV_DICT_DONT_STRDUP_KEY) av_free(key); + if (flags & AV_DICT_DONT_STRDUP_VAL) av_free(value); return 0; + } if (flags & AV_DICT_APPEND) oldval = tag->value; else