lavu/frame: Add error report if av_image_fill_pointers fail.
authorJun Zhao <mypopydev@gmail.com>
Sun, 28 Oct 2018 02:44:29 +0000 (10:44 +0800)
committerJun Zhao <jun.zhao@intel.com>
Tue, 30 Oct 2018 05:17:09 +0000 (13:17 +0800)
Add error handle if av_image_fill_pointers fail.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/frame.c

index 92626dc..9b3fb13 100644 (file)
@@ -243,11 +243,13 @@ static int get_video_buffer(AVFrame *frame, int align)
         return ret;
 
     frame->buf[0] = av_buffer_alloc(ret + 4*plane_padding);
-    if (!frame->buf[0])
+    if (!frame->buf[0]) {
+        ret = AVERROR(ENOMEM);
         goto fail;
+    }
 
-    if (av_image_fill_pointers(frame->data, frame->format, padded_height,
-                               frame->buf[0]->data, frame->linesize) < 0)
+    if ((ret = av_image_fill_pointers(frame->data, frame->format, padded_height,
+                                      frame->buf[0]->data, frame->linesize)) < 0)
         goto fail;
 
     for (i = 1; i < 4; i++) {
@@ -260,7 +262,7 @@ static int get_video_buffer(AVFrame *frame, int align)
     return 0;
 fail:
     av_frame_unref(frame);
-    return AVERROR(ENOMEM);
+    return ret;
 }
 
 static int get_audio_buffer(AVFrame *frame, int align)