[MPlayer-cvslog] r38199 - trunk/libmpcodecs/ad_spdif.c

reimar subversion at mplayerhq.hu
Sun Nov 1 17:07:44 EET 2020


Author: reimar
Date: Sun Nov  1 17:07:44 2020
New Revision: 38199

Log:
ad_spdif: Use avformat_free_context to free context.

This avoids memleaks and in newest FFmpeg versions also
compile errors.

Modified:
   trunk/libmpcodecs/ad_spdif.c

Modified: trunk/libmpcodecs/ad_spdif.c
==============================================================================
--- trunk/libmpcodecs/ad_spdif.c	Sun Oct 11 09:36:37 2020	(r38198)
+++ trunk/libmpcodecs/ad_spdif.c	Sun Nov  1 17:07:44 2020	(r38199)
@@ -298,14 +298,8 @@ static void uninit(sh_audio_t *sh)
         if (spdif_ctx->header_written)
             av_write_trailer(lavf_ctx);
         av_freep(&lavf_ctx->pb);
-        if (lavf_ctx->streams) {
-            av_freep(&lavf_ctx->streams[0]->codec);
-            av_freep(&lavf_ctx->streams[0]->info);
-            av_freep(&lavf_ctx->streams[0]);
-        }
-        av_freep(&lavf_ctx->streams);
-        av_freep(&lavf_ctx->priv_data);
+        avformat_free_context(lavf_ctx);
+        lavf_ctx = NULL;
     }
-    av_freep(&lavf_ctx);
     av_freep(&spdif_ctx);
 }


More information about the MPlayer-cvslog mailing list