OSDN Git Service
(root)
/
android-x86
/
external-ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7b06ddb
)
av_dict_set: fix potential memory leak with AV_DICT_DONT_OVERWRITE
author
Janne Grunau
<janne-libav@jannau.net>
Sun, 8 Jun 2014 15:53:31 +0000
(17:53 +0200)
committer
Janne Grunau
<janne-libav@jannau.net>
Mon, 9 Jun 2014 10:33:19 +0000
(12:33 +0200)
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.
libavutil/dict.c
patch
|
blob
|
history
diff --git
a/libavutil/dict.c
b/libavutil/dict.c
index
7b4dbf2
..
e4ea776
100644
(file)
--- 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