diff options
author | Sasi Inguva <isasi-at-google.com@ffmpeg.org> | 2017-01-26 11:26:46 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-27 22:16:37 +0100 |
commit | e4a1d87ef88d57cca21ec425120c6a370fdb0210 (patch) | |
tree | 8300eb878b99338d6c926161465128df31ec9a09 /libavformat/matroskaenc.c | |
parent | d1df72a7025b193d50e660beb1445669ed67a6ac (diff) | |
download | ffmpeg-e4a1d87ef88d57cca21ec425120c6a370fdb0210.tar.gz |
lavf/matroskaenc.c: Free dyn bufs in mkv_free. Fixes memory leaks when muxing fails.
Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index f731b678b9..88f6c647b9 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -393,6 +393,23 @@ static void put_xiph_size(AVIOContext *pb, int size) * Free the members allocated in the mux context. */ static void mkv_free(MatroskaMuxContext *mkv) { + uint8_t* buf; + if (mkv->dyn_bc) { + avio_close_dyn_buf(mkv->dyn_bc, &buf); + av_free(buf); + } + if (mkv->info_bc) { + avio_close_dyn_buf(mkv->info_bc, &buf); + av_free(buf); + } + if (mkv->tracks_bc) { + avio_close_dyn_buf(mkv->tracks_bc, &buf); + av_free(buf); + } + if (mkv->tags_bc) { + avio_close_dyn_buf(mkv->tags_bc, &buf); + av_free(buf); + } if (mkv->main_seekhead) { av_freep(&mkv->main_seekhead->entries); av_freep(&mkv->main_seekhead); |