From aeb8b65cdf3ede71d0c0781585b2f25aaa864a47 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sun, 20 Oct 2019 23:44:05 -0300 Subject: [PATCH] avformat/flacenc: add a deinit function Reviewed-by: Andreas Rheinhardt Signed-off-by: James Almer --- 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, };