[PATCH 06/18] libmpcodecs/ad_ffmpeg: properly free codec context

Nicolas George <[email protected]> Tue, 28 Jul 2026 20:15:02 +0200
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
---
 libmpcodecs/ad_ffmpeg.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index 866379946..b0df79339 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -194,13 +194,7 @@ static int init(sh_audio_t *sh_audio)
 
 static void uninit(sh_audio_t *sh)
 {
-    AVCodecContext *lavc_context = sh->context;
-
-    if (avcodec_close(lavc_context) < 0)
-	mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_CantCloseCodec);
-    av_freep(&lavc_context->opaque);
-    av_freep(&lavc_context->extradata);
-    av_freep(&lavc_context);
+    avcodec_free_context((AVCodecContext **)&sh->context);
 }
 
 static int control(sh_audio_t *sh,int cmd,void* arg, ...)
-- 
2.53.0

_______________________________________________
MPlayer-dev-eng mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo/%(_internal_name)s