diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-01-26 11:27:39 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-01-26 17:24:41 +0100 |
commit | 262b554358120a945c32045691a02ee1abea7841 (patch) | |
tree | ddb0b607f557d691dd0fd9e65ebf7fd76a6d3049 /libavformat/gxfenc.c | |
parent | e6aa9b11bf00167ec52cddbc9808cae632b3f774 (diff) | |
download | ffmpeg-262b554358120a945c32045691a02ee1abea7841.tar.gz |
avformat/gxfenc: Add deinit function
Fixes memleaks when the trailer is never written (e.g. if the call to
gxf_write_map_packet() at the end of gxf_write_header() fails).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/gxfenc.c')
-rw-r--r-- | libavformat/gxfenc.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index e09b8d7625..9eebefc683 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -853,8 +853,6 @@ static int gxf_write_trailer(AVFormatContext *s) int i; int ret; - ff_audio_interleave_close(s); - gxf_write_eos_packet(pb); end = avio_tell(pb); avio_seek(pb, 0, SEEK_SET); @@ -872,10 +870,17 @@ static int gxf_write_trailer(AVFormatContext *s) avio_seek(pb, end, SEEK_SET); + return 0; +} + +static void gxf_deinit(AVFormatContext *s) +{ + GXFContext *gxf = s->priv_data; + + ff_audio_interleave_close(s); + av_freep(&gxf->flt_entries); av_freep(&gxf->map_offsets); - - return 0; } static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size) @@ -1025,5 +1030,6 @@ AVOutputFormat ff_gxf_muxer = { .write_header = gxf_write_header, .write_packet = gxf_write_packet, .write_trailer = gxf_write_trailer, + .deinit = gxf_deinit, .interleave_packet = gxf_interleave_packet, }; |