diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-06-20 17:16:56 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-06-20 17:16:56 +0000 |
commit | ccafd47251a83cab01dcde42dc09db425c80e69a (patch) | |
tree | c78f4d865efd3ef0b43c8ebeccc1692abba0e3b0 /libavformat/rmdec.c | |
parent | 6919e54c00b750cd3d9d756258d3677df52f96a9 (diff) | |
download | ffmpeg-ccafd47251a83cab01dcde42dc09db425c80e69a.tar.gz |
factorize read_header failure freeing code
Originally committed as revision 13837 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r-- | libavformat/rmdec.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 128e3a2a9b..502b1f4e22 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -297,7 +297,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) for(;;) { if (url_feof(pb)) - goto fail; + return -1; tag = get_le32(pb); tag_size = get_be32(pb); get_be16(pb); @@ -311,7 +311,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) tag_size); #endif if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A')) - goto fail; + return -1; switch(tag) { case MKTAG('P', 'R', 'O', 'P'): /* file header */ @@ -336,7 +336,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) case MKTAG('M', 'D', 'P', 'R'): st = av_new_stream(s, 0); if (!st) - goto fail; + return AVERROR(ENOMEM); st->id = get_be16(pb); get_be32(pb); /* max bit rate */ st->codec->bit_rate = get_be32(pb); /* bit rate */ @@ -369,12 +369,6 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) get_be32(pb); /* next data header */ rm->curpic_num = -1; return 0; - - fail: - for(i=0;i<s->nb_streams;i++) { - av_free(s->streams[i]); - } - return AVERROR(EIO); } static int get_num(ByteIOContext *pb, int *len) |