aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/dict.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-09 17:13:56 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-09 17:25:09 +0200
commit375fa061255a244879df306143628a18c74ee74d (patch)
treedb472d6349260bd348f92a9945a6bc0c7d0a74cb /libavutil/dict.c
parent383d8ddf29513c614778db269899aba71094c051 (diff)
parent1619274fb393f55a365cc10f88faa173c9a8e772 (diff)
downloadffmpeg-375fa061255a244879df306143628a18c74ee74d.tar.gz
Merge commit '1619274fb393f55a365cc10f88faa173c9a8e772'
* commit '1619274fb393f55a365cc10f88faa173c9a8e772': av_dict_set: fix potential memory leak with AV_DICT_DONT_OVERWRITE Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/dict.c')
-rw-r--r--libavutil/dict.c5
1 files changed, 4 insertions, 1 deletions
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