diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 297ff78840..f8de0281ff 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1518,8 +1518,7 @@ static int estimate_best_b_count(MpegEncContext *s) } } - avcodec_close(c); - av_freep(&c); + avcodec_free_context(&c); return best_b_count; }