summaryrefslogtreecommitdiff
path: root/libavformat/oggparsecelt.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/oggparsecelt.c
parentcb88cdf7730e309df22ddbbc1ae4ebcd9ebc529e (diff)
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/oggparsecelt.c')
-rw-r--r--libavformat/oggparsecelt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/oggparsecelt.c b/libavformat/oggparsecelt.c
index 9c438a096a..f7a88af616 100644
--- a/libavformat/oggparsecelt.c
+++ b/libavformat/oggparsecelt.c
@@ -37,6 +37,7 @@ static int celt_header(AVFormatContext *s, int idx)
AVStream *st = s->streams[idx];
struct oggcelt_private *priv = os->private;
uint8_t *p = os->buf + os->pstart;
+ int ret;
if (os->psize == 60 &&
!memcmp(p, ff_celt_codec.magic, ff_celt_codec.magicsize)) {
@@ -48,9 +49,10 @@ static int celt_header(AVFormatContext *s, int idx)
priv = av_malloc(sizeof(struct oggcelt_private));
if (!priv)
return AVERROR(ENOMEM);
- if (ff_alloc_extradata(st->codecpar, 2 * sizeof(uint32_t)) < 0) {
+ ret = ff_alloc_extradata(st->codecpar, 2 * sizeof(uint32_t));
+ if (ret < 0) {
av_free(priv);
- return AVERROR(ENOMEM);
+ return ret;
}
version = AV_RL32(p + 28);
/* unused header size field skipped */