From 27dbc47c05e07486feba1ab829db584da2159648 Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Sun, 28 Feb 2010 20:49:21 +0000 Subject: [PATCH] Plug some memory leaks in NUT muxer and demuxer Originally committed as revision 22120 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/nutdec.c | 4 ++++ libavformat/nutenc.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index ea2ac86554..8ca59231a8 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -897,9 +897,13 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag static int nut_read_close(AVFormatContext *s) { NUTContext *nut = s->priv_data; + int i; av_freep(&nut->time_base); av_freep(&nut->stream); + av_tree_destroy_free_elem(nut->syncpoints); + for(i = 1; i < nut->header_count; i++) + av_freep(&nut->header[i]); return 0; } diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 03d3712638..8509aa2faa 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -797,6 +797,9 @@ static int write_trailer(AVFormatContext *s){ while(nut->header_count<3) write_headers(nut, bc); put_flush_packet(bc); + av_freep(&nut->stream); + av_freep(&nut->time_base); + av_tree_destroy_free_elem(nut->syncpoints); return 0; }