Index: libavformat/oggdec.c |
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c |
index 0e0b83804c19f87deb806151d98b99698aa7db93..81066ca673cec1946ce235c12c9b2641e9a21ecc 100644 |
--- a/libavformat/oggdec.c |
+++ b/libavformat/oggdec.c |
@@ -629,8 +629,15 @@ static int ogg_read_close(AVFormatContext *s) |
int i; |
for (i = 0; i < ogg->nstreams; i++){ |
- av_free (ogg->streams[i].buf); |
- av_free (ogg->streams[i].private); |
+ struct ogg_stream os = ogg->streams[i]; |
+ struct oggvorbis_private *priv = os.private; |
+ if (priv && priv->packet && os.buf) { |
+ int pkt_type = os.buf[os.pstart]; |
+ if (pkt_type & 1 && pkt_type <= 5) |
+ av_freep (&priv->packet[pkt_type >> 1]); |
+ } |
+ av_free (os.buf); |
+ av_free (os.private); |
} |
av_free (ogg->streams); |
return 0; |