diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 2b993c4a93..93ba5d660b 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -431,12 +431,14 @@ static void uninit(sh_video_t *sh){ ); } + if (avctx) { if (avctx && avctx->codec && avcodec_close(avctx) < 0) mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); av_freep(&avctx->extradata); av_freep(&avctx->palctrl); av_freep(&avctx->slice_offset); + } av_freep(&avctx); av_freep(&ctx->pic);