aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oggdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-28 15:16:54 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-03-02 03:12:26 +0100
commite46ab997506e8aa84344c29553ebacca7993904c (patch)
tree90c696ee1bef2050d56c3028a1935e34548c7c5f /libavformat/oggdec.c
parentfb6fa48fce3a09a30403326973f03f0343c6e24a (diff)
downloadffmpeg-e46ab997506e8aa84344c29553ebacca7993904c.tar.gz
avformat/oggdec: fix leak in ogg_restore()
Fixes: asan_bug_leak Found-by: Thomas Guilbert <tguilbert@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r--libavformat/oggdec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 98cd0f55c7..edeae2ba83 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -127,8 +127,12 @@ static int ogg_restore(AVFormatContext *s)
ogg->state = ost->next;
- for (i = 0; i < ogg->nstreams; i++)
+ for (i = 0; i < ogg->nstreams; i++) {
av_freep(&ogg->streams[i].buf);
+ if (i >= ost->nstreams || !ost->streams[i].private) {
+ free_stream(s, i);
+ }
+ }
avio_seek(bc, ost->pos, SEEK_SET);
ogg->page_pos = -1;