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; }