diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-07 13:32:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-07 14:03:48 +0100 |
commit | 2db8660f094ab15ce15f024f97134440a3654932 (patch) | |
tree | a823109bedebea39e66b9e2d30451b3aca3bd3d2 | |
parent | 8b4842c2e2cc85498a62a9987b4c2de77e027332 (diff) | |
parent | 89b51b570daa80e6e3790fcd449fe61fc5574e07 (diff) | |
download | ffmpeg-2db8660f094ab15ce15f024f97134440a3654932.tar.gz |
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 07a866282f08985c65c47ebabcf7b20f1c46daa0
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>
-rw-r--r-- | libavformat/oggdec.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index c3291cfbd4..628ef23d8f 100644 --- a/libavformat/oggdec.c +++ b/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) { |