[FFmpeg-cvslog] avcodec/nvenc: set correct error code
Pan Bian
git at videolan.org
Wed Nov 29 11:53:46 EET 2017
ffmpeg | branch: master | Pan Bian <bianpan2016 at 163.com> | Mon Nov 27 09:52:50 2017 +0800| [eb69e7bed80a1c8afee9acf9f8daff6be5e9ea62] | committer: Timo Rothenpieler
avcodec/nvenc: set correct error code
In function process_output_surface(), the return value is 0 on the path
that av_mallocz() returns a NULL pointer. 0 indicates success, which
deviates from the fact. Return "AVERROR(ENOMEM)" instead of "0".
Signed-off-by: Pan Bian <bianpan2016 at 163.com>
Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb69e7bed80a1c8afee9acf9f8daff6be5e9ea62
---
libavcodec/nvenc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 79f7dce5f1..4a91d99720 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1763,8 +1763,10 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
}
slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));
- if (!slice_offsets)
+ if (!slice_offsets) {
+ res = AVERROR(ENOMEM);
goto error;
+ }
lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;
More information about the ffmpeg-cvslog
mailing list