[FFmpeg-devel] [PATCH v3 16/22] avcodec/mpegvideo: simplify check for av_frame_alloc

lance.lmwang at gmail.com lance.lmwang at gmail.com
Tue Jun 2 18:17:00 EEST 2020


From: Limin Wang <lance.lmwang at gmail.com>

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavcodec/mpegvideo.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 34dfda5..58fc850 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -941,17 +941,10 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
         if (!s->picture[i].f)
             goto fail_nomem;
     }
-    s->next_picture.f = av_frame_alloc();
-    if (!s->next_picture.f)
-        goto fail_nomem;
-    s->last_picture.f = av_frame_alloc();
-    if (!s->last_picture.f)
-        goto fail_nomem;
-    s->current_picture.f = av_frame_alloc();
-    if (!s->current_picture.f)
-        goto fail_nomem;
-    s->new_picture.f = av_frame_alloc();
-    if (!s->new_picture.f)
+    if (!(s->next_picture.f    = av_frame_alloc()) ||
+        !(s->last_picture.f    = av_frame_alloc()) ||
+        !(s->current_picture.f = av_frame_alloc()) ||
+        !(s->new_picture.f     = av_frame_alloc()))
         goto fail_nomem;
 
     if ((ret = init_context_frame(s)))
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list