Browse code

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>

Pan Bian authored on 2017/11/27 10:52:50
Showing 1 changed files
... ...
@@ -1763,8 +1763,10 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur
1763 1763
     }
1764 1764
     slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));
1765 1765
 
1766
-    if (!slice_offsets)
1766
+    if (!slice_offsets) {
1767
+        res = AVERROR(ENOMEM);
1767 1768
         goto error;
1769
+    }
1768 1770
 
1769 1771
     lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;
1770 1772