Merge commit '89b51b570daa80e6e3790fcd449fe61fc5574e07'

* commit '89b51b570daa80e6e3790fcd449fe61fc5574e07':
  oggdec: free the ogg streams on read_header failure

Conflicts:
	libavformat/oggdec.c

Original commit this was based on: (this merge just moves the function up)
commit 07a866282f
Author: Michael Niedermayer <michaelni@gmx.at>
Date:   Tue Nov 20 15:12:37 2012 +0100

    oggdec: fix memleak on header parsing failure

    Fixes Ticket1931

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/8/head
Michael Niedermayer 12 years ago
commit 2db8660f09
  1. 27
      libavformat/oggdec.c

@ -57,7 +57,6 @@ static const struct ogg_codec * const ogg_codecs[] = {
};
static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts);
static int ogg_read_close(AVFormatContext *s);
//FIXME We could avoid some structure duplication
static int ogg_save(AVFormatContext *s)
@ -599,6 +598,19 @@ static int ogg_get_length(AVFormatContext *s)
return 0;
}
static int ogg_read_close(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
int i;
for (i = 0; i < ogg->nstreams; i++) {
av_free(ogg->streams[i].buf);
av_free(ogg->streams[i].private);
}
av_free(ogg->streams);
return 0;
}
static int ogg_read_header(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
@ -722,19 +734,6 @@ retry:
return psize;
}
static int ogg_read_close(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
int i;
for (i = 0; i < ogg->nstreams; i++) {
av_free(ogg->streams[i].buf);
av_free(ogg->streams[i].private);
}
av_free(ogg->streams);
return 0;
}
static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index,
int64_t *pos_arg, int64_t pos_limit)
{

Loading…
Cancel
Save