diff options
author | James Almer <jamrial@gmail.com> | 2019-10-18 23:23:32 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-10-21 17:20:20 -0300 |
commit | 02cf2391966afb68269f0cd4d9ce876dc48ec66f (patch) | |
tree | 5e65401a7aa11fd89865e8a7b7b2c3604b0289d7 /libavformat/utils.c | |
parent | 27bae5aacafed376350533e7cde2b396b589a15c (diff) | |
download | ffmpeg-02cf2391966afb68269f0cd4d9ce876dc48ec66f.tar.gz |
avformat: call AVOutputFormat->deinit() when freeing the context
Despite the doxy stating that it's called when the muxer is destroyed,
this was not true in practice. It's only called by av_write_trailer()
and on init() failure.
An AVFormatContext may be closed without writing the trailer if errors
ocurred while muxing packets, so in order to prevent memory leaks, it
should effectively be called when freeing the muxer.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 60f0229adc..cfb6d03397 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4437,6 +4437,9 @@ void avformat_free_context(AVFormatContext *s) if (!s) return; + if (s->oformat && s->oformat->deinit && s->internal->initialized) + s->oformat->deinit(s); + av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); |