mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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.
This commit is contained in:
parent
7b06ddb835
commit
1619274fb3
@ -76,8 +76,11 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value,
|
|||||||
m = *pm = av_mallocz(sizeof(*m));
|
m = *pm = av_mallocz(sizeof(*m));
|
||||||
|
|
||||||
if (tag) {
|
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;
|
return 0;
|
||||||
|
}
|
||||||
if (flags & AV_DICT_APPEND)
|
if (flags & AV_DICT_APPEND)
|
||||||
oldval = tag->value;
|
oldval = tag->value;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user