X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Ffsb.c;h=fd3e484371f1607c59b453e925451ee412e15723;hb=337f777f378cfcc0d6f0d01fb7125905e8b0da55;hp=4f59576e35367198830b5440e7f8ffcbb4bafa87;hpb=4f9a8d3fe2f9485ee08848d336ee96f15ec0e7e6;p=ffmpeg diff --git a/libavformat/fsb.c b/libavformat/fsb.c index 4f59576e353..fd3e484371f 100644 --- a/libavformat/fsb.c +++ b/libavformat/fsb.c @@ -25,7 +25,7 @@ #include "avio.h" #include "internal.h" -static int fsb_probe(AVProbeData *p) +static int fsb_probe(const AVProbeData *p) { if (memcmp(p->buf, "FSB", 3) || p->buf[3] - '0' < 1 || p->buf[3] - '0' > 5) return 0; @@ -41,6 +41,7 @@ static int fsb_read_header(AVFormatContext *s) int64_t offset; AVCodecParameters *par; AVStream *st = avformat_new_stream(s, NULL); + int ret; avio_skip(pb, 3); // "FSB" version = avio_r8(pb) - '0'; @@ -86,9 +87,9 @@ static int fsb_read_header(AVFormatContext *s) par->block_align = 8 * par->channels; if (par->channels > INT_MAX / 32) return AVERROR_INVALIDDATA; - ff_alloc_extradata(par, 32 * par->channels); - if (!par->extradata) - return AVERROR(ENOMEM); + ret = ff_alloc_extradata(par, 32 * par->channels); + if (ret < 0) + return ret; avio_seek(pb, 0x68, SEEK_SET); for (c = 0; c < par->channels; c++) { avio_read(pb, par->extradata + 32 * c, 32); @@ -130,18 +131,18 @@ static int fsb_read_header(AVFormatContext *s) switch (par->codec_id) { case AV_CODEC_ID_XMA2: - ff_alloc_extradata(par, 34); - if (!par->extradata) - return AVERROR(ENOMEM); + ret = ff_alloc_extradata(par, 34); + if (ret < 0) + return ret; memset(par->extradata, 0, 34); par->block_align = 2048; break; case AV_CODEC_ID_ADPCM_THP: if (par->channels > INT_MAX / 32) return AVERROR_INVALIDDATA; - ff_alloc_extradata(par, 32 * par->channels); - if (!par->extradata) - return AVERROR(ENOMEM); + ret = ff_alloc_extradata(par, 32 * par->channels); + if (ret < 0) + return ret; avio_seek(pb, 0x80, SEEK_SET); for (c = 0; c < par->channels; c++) { avio_read(pb, par->extradata + 32 * c, 32);