[SCM] libav/experimental: av_dict_set: fix potential memory leak with AV_DICT_DONT_OVERWRITE
siretart at users.alioth.debian.org
siretart at users.alioth.debian.org
Sun Aug 10 16:03:25 UTC 2014
The following commit has been merged in the experimental branch:
commit 1619274fb393f55a365cc10f88faa173c9a8e772
Author: Janne Grunau <janne-libav at jannau.net>
Date: Sun Jun 8 17:53:31 2014 +0200
av_dict_set: fix potential memory leak with AV_DICT_DONT_OVERWRITE
av_dict_set leaks it key/value arguments if AV_DICT_DONT_OVERWRITE is
combined with AV_DICT_DONT_STRDUP_{KEY,VAL} and the key exists.
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 7b4dbf2..e4ea776 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
--
Libav/FFmpeg packaging
More information about the pkg-multimedia-commits
mailing list