diff mbox series

[FFmpeg-devel,v4,17/24] avcodec/iirfilter: remove FF_ALLOCZ_OR_GOTO and gotos label

Message ID 1591111618-15778-17-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/iirfilter.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
index 749fa57..ddd42c2 100644
--- a/libavcodec/iirfilter.c
+++ b/libavcodec/iirfilter.c
@@ -171,12 +171,10 @@  av_cold struct FFIIRFilterCoeffs *ff_iir_filter_init_coeffs(void *avc,
     if (order <= 0 || order > MAXORDER || cutoff_ratio >= 1.0)
         return NULL;
 
-    FF_ALLOCZ_OR_GOTO(avc, c, sizeof(FFIIRFilterCoeffs),
-                      init_fail);
-    FF_ALLOC_OR_GOTO(avc, c->cx, sizeof(c->cx[0]) * ((order >> 1) + 1),
-                     init_fail);
-    FF_ALLOC_OR_GOTO(avc, c->cy, sizeof(c->cy[0]) * order,
-                     init_fail);
+    if (!(c     = av_mallocz(sizeof(*c)))                            ||
+        !(c->cx = av_malloc (sizeof(c->cx[0]) * ((order >> 1) + 1))) ||
+        !(c->cy = av_malloc (sizeof(c->cy[0]) * order)))
+         return NULL;
     c->order = order;
 
     switch (filt_type) {
@@ -190,13 +188,11 @@  av_cold struct FFIIRFilterCoeffs *ff_iir_filter_init_coeffs(void *avc,
         break;
     default:
         av_log(avc, AV_LOG_ERROR, "filter type is not currently implemented\n");
-        goto init_fail;
+        return NULL;
     }
 
     if (!ret)
         return c;
-
-init_fail:
     return NULL;
 }