diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2014-07-29 21:16:35 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2014-08-23 15:28:48 +0200 |
commit | 8fc9bd0d32f0ef806adddfb7dfc56c538c85f4d4 (patch) | |
tree | a8e2d6ad6502dfb2390df9a4f8c184f2fc27ca6c /libavutil/dict.h | |
parent | 45c7f3997ea11c3d1007b2126b1c0049a8c27105 (diff) | |
download | ffmpeg-8fc9bd0d32f0ef806adddfb7dfc56c538c85f4d4.tar.gz |
dict.c: Free non-strduped av_dict_set arguments on error.
Unfortunately this was not explicitly documented and thus
might be risky.
But all uses I could find in FFmpeg and one in VLC had a memleak
in these cases, and I could not find any that relied on the previous
behaviour.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavutil/dict.h')
-rw-r--r-- | libavutil/dict.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavutil/dict.h b/libavutil/dict.h index 06f1621d45..9b3381b828 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -115,6 +115,9 @@ int av_dict_count(const AVDictionary *m); /** * Set the given entry in *pm, overwriting an existing entry. * + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, + * these arguments will be freed on error. + * * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL * a dictionary struct is allocated and put in *pm. * @param key entry key to add to *pm (will be av_strduped depending on flags) @@ -127,6 +130,8 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags /** * Convenience wrapper for av_dict_set that converts the value to a string * and stores it. + * + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. */ int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); |