From 8fc9bd0d32f0ef806adddfb7dfc56c538c85f4d4 Mon Sep 17 00:00:00 2001 From: Reimar Döffinger Date: Tue, 29 Jul 2014 21:16:35 +0200 Subject: dict.c: Free non-strduped av_dict_set arguments on error. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- libavutil/dict.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libavutil/dict.c') diff --git a/libavutil/dict.c b/libavutil/dict.c index c17ce7a3cb..bdb56908d3 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -126,6 +126,8 @@ err_out: av_free(m->elems); av_freep(pm); } + if (flags & AV_DICT_DONT_STRDUP_KEY) av_free(key); + if (flags & AV_DICT_DONT_STRDUP_VAL) av_free(value); return AVERROR(ENOMEM); } -- cgit v1.2.3