From c1e439d7e9abab3cebdc937636393b1656e095d9 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 10 Dec 2019 22:59:53 +0100 Subject: 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 Signed-off-by: Michael Niedermayer --- libavformat/rtpdec_h263.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libavformat/rtpdec_h263.c') diff --git a/libavformat/rtpdec_h263.c b/libavformat/rtpdec_h263.c index 9b71ed7efe..1905b435f8 100644 --- a/libavformat/rtpdec_h263.c +++ b/libavformat/rtpdec_h263.c @@ -30,7 +30,7 @@ int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, { uint8_t *ptr; uint16_t header; - int startcode, vrc, picture_header; + int startcode, vrc, picture_header, ret; if (len < 2) { av_log(ctx, AV_LOG_ERROR, "Too short H.263 RTP packet\n"); @@ -73,9 +73,9 @@ int ff_h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, return AVERROR_INVALIDDATA; } - if (av_new_packet(pkt, len + startcode)) { + if ((ret = av_new_packet(pkt, len + startcode)) < 0) { av_log(ctx, AV_LOG_ERROR, "Out of memory\n"); - return AVERROR(ENOMEM); + return ret; } pkt->stream_index = st->index; ptr = pkt->data; -- cgit v1.2.3