diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index f1ad630c5e..998a33b43c 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -238,7 +238,8 @@ static int ogg_read_page(AVFormatContext *s, int *str) for (n = 0; n < ogg->nstreams; n++) { av_freep(&ogg->streams[n].buf); - av_freep(&ogg->streams[n].private); + if (!ogg->state || ogg->state->streams[n].private != ogg->streams[n].private) + av_freep(&ogg->streams[n].private); } ogg->curidx = -1; ogg->nstreams = 0;