summaryrefslogtreecommitdiff
path: root/libavformat/sierravmd.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-12-10 22:59:53 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-12 19:25:33 +0100
commitc1e439d7e9abab3cebdc937636393b1656e095d9 (patch)
treebe0ae941a23b62c42b152e2b9aa0a22f8c793d4e /libavformat/sierravmd.c
parentcb88cdf7730e309df22ddbbc1ae4ebcd9ebc529e (diff)
downloadffmpeg-c1e439d7e9abab3cebdc937636393b1656e095d9.tar.gz
avformat: Forward errors where possible
It is not uncommon to find code where the caller thinks to know better what the return value should be than the callee. E.g. something like "if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit changes several instances of this to instead forward the actual error. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/sierravmd.c')
-rw-r--r--libavformat/sierravmd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index d586fc6ac0..8c2322eda6 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -127,8 +127,8 @@ static int vmd_read_header(AVFormatContext *s)
vst->codecpar->width >>= 1;
vst->codecpar->height >>= 1;
}
- if (ff_alloc_extradata(vst->codecpar, VMD_HEADER_SIZE))
- return AVERROR(ENOMEM);
+ if ((ret = ff_alloc_extradata(vst->codecpar, VMD_HEADER_SIZE)) < 0)
+ return ret;
memcpy(vst->codecpar->extradata, vmd->vmd_header, VMD_HEADER_SIZE);
}
@@ -283,8 +283,9 @@ static int vmd_read_packet(AVFormatContext *s,
if(ffio_limit(pb, frame->frame_size) != frame->frame_size)
return AVERROR(EIO);
- if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
- return AVERROR(ENOMEM);
+ ret = av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD);
+ if (ret < 0)
+ return ret;
pkt->pos= avio_tell(pb);
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
if(vmd->is_indeo3 && frame->frame_record[0] == 0x02)