]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_anequalizer.c
checkasm/vf_eq: add test for vf_eq
[ffmpeg] / libavfilter / af_anequalizer.c
index 24034602fd056bbd113e7bfcfb2cb9c8cafa2548..ee82474083e57a54eec0476c8c0cefbc91e02263 100644 (file)
@@ -189,6 +189,7 @@ static av_cold int init(AVFilterContext *ctx)
 {
     AudioNEqualizerContext *s = ctx->priv;
     AVFilterPad pad, vpad;
+    int ret;
 
     pad = (AVFilterPad){
         .name         = av_strdup("out0"),
@@ -204,14 +205,25 @@ static av_cold int init(AVFilterContext *ctx)
             .type         = AVMEDIA_TYPE_VIDEO,
             .config_props = config_video,
         };
-        if (!vpad.name)
+        if (!vpad.name) {
+            av_freep(&pad.name);
             return AVERROR(ENOMEM);
+        }
     }
 
-    ff_insert_outpad(ctx, 0, &pad);
+    ret = ff_insert_outpad(ctx, 0, &pad);
+    if (ret < 0) {
+        av_freep(&pad.name);
+        return ret;
+    }
 
-    if (s->draw_curves)
-        ff_insert_outpad(ctx, 1, &vpad);
+    if (s->draw_curves) {
+        ret = ff_insert_outpad(ctx, 1, &vpad);
+        if (ret < 0) {
+            av_freep(&vpad.name);
+            return ret;
+        }
+    }
 
     return 0;
 }
@@ -259,9 +271,8 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
     AudioNEqualizerContext *s = ctx->priv;
 
-    av_freep(&ctx->output_pads[0].name);
-    if (s->draw_curves)
-        av_freep(&ctx->output_pads[1].name);
+    for (int i = 0; i < ctx->nb_outputs; i++)
+        av_freep(&ctx->output_pads[i].name);
     av_frame_free(&s->video);
     av_freep(&s->filters);
     s->nb_filters = 0;