[FFmpeg-devel] [PATCH 3/3] avfilter/vf_minterpolate: Remove redundant code for freeing

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Oct 6 17:28:40 EEST 2020


ad73b32d2922f4237405043d19763229aee0e59e added some code for freeing in
the input's config_props function, yet this is unnecessary as uninit is
called anyway if config_props fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavfilter/vf_minterpolate.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
index bf45662913..969463f021 100644
--- a/libavfilter/vf_minterpolate.c
+++ b/libavfilter/vf_minterpolate.c
@@ -340,7 +340,7 @@ static int config_input(AVFilterLink *inlink)
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
     const int height = inlink->h;
     const int width  = inlink->w;
-    int i, ret = 0;
+    int i;
 
     mi_ctx->log2_chroma_h = desc->log2_chroma_h;
     mi_ctx->log2_chroma_w = desc->log2_chroma_w;
@@ -380,10 +380,8 @@ static int config_input(AVFilterLink *inlink)
         mi_ctx->pixel_mvs = av_mallocz_array(width * height, sizeof(PixelMVS));
         mi_ctx->pixel_weights = av_mallocz_array(width * height, sizeof(PixelWeights));
         mi_ctx->pixel_refs = av_mallocz_array(width * height, sizeof(PixelRefs));
-        if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights || !mi_ctx->pixel_refs) {
-            ret = AVERROR(ENOMEM);
-            goto fail;
-        }
+        if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights || !mi_ctx->pixel_refs)
+            return AVERROR(ENOMEM);
 
         if (mi_ctx->me_mode == ME_MODE_BILAT)
             if (!(mi_ctx->int_blocks = av_mallocz_array(mi_ctx->b_count, sizeof(Block))))
@@ -405,13 +403,6 @@ static int config_input(AVFilterLink *inlink)
     }
 
     return 0;
-fail:
-    for (i = 0; i < NB_FRAMES; i++)
-        av_freep(&mi_ctx->frames[i].blocks);
-    av_freep(&mi_ctx->pixel_mvs);
-    av_freep(&mi_ctx->pixel_weights);
-    av_freep(&mi_ctx->pixel_refs);
-    return ret;
 }
 
 static int config_output(AVFilterLink *outlink)
-- 
2.25.1



More information about the ffmpeg-devel mailing list