[FFmpeg-cvslog] avformat/flacenc: add a deinit function

James Almer git at videolan.org
Mon Oct 21 23:37:06 EEST 2019


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun Oct 20 23:44:05 2019 -0300| [aeb8b65cdf3ede71d0c0781585b2f25aaa864a47] | committer: James Almer

avformat/flacenc: add a deinit function

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aeb8b65cdf3ede71d0c0781585b2f25aaa864a47
---

 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,
 };



More information about the ffmpeg-cvslog mailing list