[FFmpeg-cvslog] avcodec: free priv_data in avcodec_copy_context()

Michael Niedermayer git at videolan.org
Tue Aug 13 15:29:28 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Aug 13 14:32:42 2013 +0200| [cba9a40d47aefc6853ca6bb8d72096079baac50c] | committer: Michael Niedermayer

avcodec: free priv_data in avcodec_copy_context()

Fixes memleak
Fixes Ticket2216

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cba9a40d47aefc6853ca6bb8d72096079baac50c
---

 libavcodec/options.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index b68c300..02fb89f 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 */



More information about the ffmpeg-cvslog mailing list