summaryrefslogtreecommitdiff
path: root/libavcodec/nvenc.c
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2017-11-27 09:52:50 +0800
committerTimo Rothenpieler <timo@rothenpieler.org>2017-11-29 10:42:58 +0100
commiteb69e7bed80a1c8afee9acf9f8daff6be5e9ea62 (patch)
tree4cd15b0ac02604668e4069e4dc16ee2418e182ff /libavcodec/nvenc.c
parent815e34b5b4ed8fbb6c9d7b7b042ae49848bc170c (diff)
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@163.com> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r--libavcodec/nvenc.c4
1 files changed, 3 insertions, 1 deletions
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;