]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mpegvideo: simplify check for av_frame_alloc
authorLimin Wang <lance.lmwang@gmail.com>
Tue, 2 Jun 2020 15:36:54 +0000 (23:36 +0800)
committerLimin Wang <lance.lmwang@gmail.com>
Fri, 12 Jun 2020 22:59:19 +0000 (06:59 +0800)
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
libavcodec/mpegvideo.c

index eb73198b7599dbee27d30df0ee2539e1f4a98754..d3327e47cc30767c8625096443c9ad1d19be2ce5 100644 (file)
@@ -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)))