Commit 1700be58 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  oggdec: make sure the private parse data is cleaned up
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 2db8660f d894f747
......@@ -605,6 +605,10 @@ static int ogg_read_close(AVFormatContext *s)
for (i = 0; i < ogg->nstreams; i++) {
av_free(ogg->streams[i].buf);
if (ogg->streams[i].codec &&
ogg->streams[i].codec->cleanup) {
ogg->streams[i].codec->cleanup(s, i);
}
av_free(ogg->streams[i].private);
}
av_free(ogg->streams);
......
......@@ -55,6 +55,7 @@ struct ogg_codec {
* Number of expected headers
*/
int nb_header;
void (*cleanup)(AVFormatContext *s, int idx);
};
struct ogg_stream {
......
......@@ -192,6 +192,16 @@ fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv,
return offset;
}
static int vorbis_cleanup(AVFormatContext *s, int idx)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
struct oggvorbis_private *priv = os->private;
int i;
if (os->private)
for (i = 0; i < 3; i++)
av_freep(&priv->packet[i]);
}
static int
vorbis_header (AVFormatContext * s, int idx)
......@@ -373,5 +383,6 @@ const struct ogg_codec ff_vorbis_codec = {
.magicsize = 7,
.header = vorbis_header,
.packet = vorbis_packet,
.cleanup= vorbis_cleanup,
.nb_header = 3,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment