[FFmpeg-devel] [PATCH 3/4] avformat/flacenc: add a deinit function

James Almer jamrial at gmail.com
Mon Oct 21 05:49:33 EEST 2019


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/flacenc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index a07260f426..93cc79bbe0 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -348,11 +348,17 @@ static int flac_write_trailer(struct AVFormatContext *s)
         av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n");
     }
 
-    av_freep(&c->streaminfo);
-
     return 0;
 }
 
+static void flac_deinit(struct AVFormatContext *s)
+{
+    FlacMuxerContext *c = s->priv_data;
+
+    ff_packet_list_free(&c->queue, &c->queue_end);
+    av_freep(&c->streaminfo);
+}
+
 static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     FlacMuxerContext *c = s->priv_data;
@@ -425,6 +431,7 @@ AVOutputFormat ff_flac_muxer = {
     .write_header      = flac_write_header,
     .write_packet      = flac_write_packet,
     .write_trailer     = flac_write_trailer,
+    .deinit            = flac_deinit,
     .flags             = AVFMT_NOTIMESTAMPS,
     .priv_class        = &flac_muxer_class,
 };
-- 
2.23.0



More information about the ffmpeg-devel mailing list