avcodec/options: do a more thorough clean up in avcodec_copy_context()
authorJames Almer <jamrial@gmail.com>
Mon, 24 Apr 2017 17:53:47 +0000 (14:53 -0300)
committerJames Almer <jamrial@gmail.com>
Sat, 20 May 2017 02:37:03 +0000 (23:37 -0300)
Free coded_frame to prevent potential leaks.

Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit cac8de2da5c4935773128335c11b806faa73e19d)

libavcodec/options.c

index 35098b8..dfd1100 100644 (file)
@@ -182,6 +182,11 @@ void avcodec_free_context(AVCodecContext **pavctx)
 static void copy_context_reset(AVCodecContext *avctx)
 {
     av_opt_free(avctx);
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+    av_frame_free(&avctx->coded_frame);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     av_freep(&avctx->rc_override);
     av_freep(&avctx->intra_matrix);
     av_freep(&avctx->inter_matrix);