Commit e4a1d87e authored by Sasi Inguva's avatar Sasi Inguva Committed by Michael Niedermayer

lavf/matroskaenc.c: Free dyn bufs in mkv_free. Fixes memory leaks when muxing fails.

Signed-off-by: 's avatarSasi Inguva <isasi@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent d1df72a7
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment