From cba9a40d47aefc6853ca6bb8d72096079baac50c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <michaelni@gmx.at> Date: Tue, 13 Aug 2013 14:32:42 +0200 Subject: [PATCH] avcodec: free priv_data in avcodec_copy_context() Fixes memleak Fixes Ticket2216 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> --- libavcodec/options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/options.c b/libavcodec/options.c index b68c3001528..02fb89f5cb4 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -190,6 +190,10 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) src, dest); return AVERROR(EINVAL); } + + av_opt_free(dest); + av_free(dest->priv_data); + memcpy(dest, src, sizeof(*dest)); /* set values specific to opened codecs back to their default state */ -- GitLab