From 45e7c67affb57f0286fc111e61686025f4ef4a04 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 7 Jan 2020 14:55:44 +0100 Subject: avformat: Improve returned error codes This commit improves returned error codes by forwarding error codes. In some instances, the hardcoded returned error codes made no sense at all: The normal error code for failure of av_new_packet() is AVERROR(ENOMEM), yet there were instances where AVERROR(EIO) was returned. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer --- libavformat/idroqdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libavformat/idroqdec.c') diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 1db4cce6f0..16aa2a146e 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -205,8 +205,9 @@ static int roq_read_packet(AVFormatContext *s, } /* load up the packet */ - if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE)) - return AVERROR(EIO); + ret = av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE); + if (ret < 0) + return ret; /* copy over preamble */ memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE); -- cgit v1.2.3