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/nuv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libavformat/nuv.c') diff --git a/libavformat/nuv.c b/libavformat/nuv.c index a1edbf88df..612f845b4b 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -74,7 +74,7 @@ static int get_codec_data(AVFormatContext *s, AVIOContext *pb, AVStream *vst, if (!vst && !myth) return 1; // no codec data needed while (!avio_feof(pb)) { - int size, subtype; + int size, subtype, ret; frametype = avio_r8(pb); switch (frametype) { @@ -87,8 +87,8 @@ static int get_codec_data(AVFormatContext *s, AVIOContext *pb, AVStream *vst, av_freep(&vst->codecpar->extradata); vst->codecpar->extradata_size = 0; } - if (ff_get_extradata(NULL, vst->codecpar, pb, size) < 0) - return AVERROR(ENOMEM); + if ((ret = ff_get_extradata(NULL, vst->codecpar, pb, size)) < 0) + return ret; size = 0; if (!myth) return 0; -- cgit v1.2.3