diff mbox series

[FFmpeg-devel,v4,18/24] avcodec/mpegvideo: simplify check for av_frame_alloc

Message ID 1591111618-15778-18-git-send-email-lance.lmwang@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v4,01/24] avcodec/h264dec: cosmetics
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Limin Wang June 2, 2020, 3:26 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

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

Patch

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)))