diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2010-03-03 17:31:24 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2010-03-03 17:31:24 +0000 |
commit | 4b83fc0fe414dc7959a5511fcdce320ad90ac7ba (patch) | |
tree | 649182f9e748b1e89ee8ca694bb0a1be09972e3c /libavformat | |
parent | 1f6d0d42c53cde5e33e92c4529b774c256157f89 (diff) | |
download | ffmpeg-4b83fc0fe414dc7959a5511fcdce320ad90ac7ba.tar.gz |
Plug memory leak in NUT muxer and demuxer
Originally committed as revision 22174 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/nut.c | 11 | ||||
-rw-r--r-- | libavformat/nut.h | 1 | ||||
-rw-r--r-- | libavformat/nutdec.c | 1 | ||||
-rw-r--r-- | libavformat/nutenc.c | 1 |
4 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/nut.c b/libavformat/nut.c index be6bcf6a42..d969bbc526 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -69,6 +69,17 @@ void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts){ } } +static void enu_free(void *opaque, void *elem) +{ + av_free(elem); +} + +void ff_nut_free_sp(NUTContext *nut) +{ + av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free); + av_tree_destroy(nut->syncpoints); +} + const Dispositions ff_nut_dispositions[] = { {"default" , AV_DISPOSITION_DEFAULT}, {"dub" , AV_DISPOSITION_DUB}, diff --git a/libavformat/nut.h b/libavformat/nut.h index 35593e97b7..8d9695245c 100644 --- a/libavformat/nut.h +++ b/libavformat/nut.h @@ -110,6 +110,7 @@ int64_t ff_lsb2full(StreamContext *stream, int64_t lsb); int ff_nut_sp_pos_cmp(Syncpoint *a, Syncpoint *b); int ff_nut_sp_pts_cmp(Syncpoint *a, Syncpoint *b); void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts); +void ff_nut_free_sp(NUTContext *nut); extern const Dispositions ff_nut_dispositions[]; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 171315b711..6a2d2f8cda 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -901,6 +901,7 @@ static int nut_read_close(AVFormatContext *s) av_freep(&nut->time_base); av_freep(&nut->stream); + ff_nut_free_sp(nut); for(i = 1; i < nut->header_count; i++) av_freep(&nut->header[i]); diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 0cce48dea0..e06a85f54f 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -797,6 +797,7 @@ static int write_trailer(AVFormatContext *s){ while(nut->header_count<3) write_headers(nut, bc); put_flush_packet(bc); + ff_nut_free_sp(nut); av_freep(&nut->stream); av_freep(&nut->time_base); |