aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/bmv.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/bmv.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/bmv.c')
-rw-r--r--libavformat/bmv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/bmv.c b/libavformat/bmv.c
index ac567c21eb..9f03fba058 100644
--- a/libavformat/bmv.c
+++ b/libavformat/bmv.c
@@ -96,8 +96,8 @@ static int bmv_read_packet(AVFormatContext *s, AVPacket *pkt)
audio_size, c->size);
return AVERROR_INVALIDDATA;
}
- if (av_new_packet(pkt, audio_size) < 0)
- return AVERROR(ENOMEM);
+ if ((err = av_new_packet(pkt, audio_size)) < 0)
+ return err;
memcpy(pkt->data, c->packet + 1, pkt->size);
pkt->stream_index = 1;
pkt->pts = c->audio_pos;
@@ -108,8 +108,8 @@ static int bmv_read_packet(AVFormatContext *s, AVPacket *pkt)
} else
break;
}
- if (av_new_packet(pkt, c->size + 1) < 0)
- return AVERROR(ENOMEM);
+ if ((err = av_new_packet(pkt, c->size + 1)) < 0)
+ return err;
pkt->stream_index = 0;
c->get_next = 1;
memcpy(pkt->data, c->packet, pkt->size);