From 1c302b606e0fd86dd0ac1ff66e56a1f7d321d7e1 Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 24 Apr 2017 14:53:47 -0300 Subject: [PATCH] avcodec/options: do a more thorough clean up in avcodec_copy_context() Free coded_frame to prevent potential leaks. Reviewed-by: Aaron Levinson Tested-by: Michael Niedermayer Signed-off-by: James Almer (cherry picked from commit cac8de2da5c4935773128335c11b806faa73e19d) --- libavcodec/options.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/options.c b/libavcodec/options.c index 35098b864d..dfd1100d5d 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -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);