[FFmpeg-cvslog] avfilter/af_anequalizer: check return value of ff_insert_outpad()

Paul B Mahol git at videolan.org
Sat Sep 15 22:59:59 EEST 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Sep 15 21:44:13 2018 +0200| [e334765408d016801db7580498d82b0555ff5aec] | committer: Paul B Mahol

avfilter/af_anequalizer: check return value of ff_insert_outpad()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e334765408d016801db7580498d82b0555ff5aec
---

 libavfilter/af_anequalizer.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/libavfilter/af_anequalizer.c b/libavfilter/af_anequalizer.c
index 24034602fd..03d939f170 100644
--- a/libavfilter/af_anequalizer.c
+++ b/libavfilter/af_anequalizer.c
@@ -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"),
@@ -208,10 +209,19 @@ static av_cold int init(AVFilterContext *ctx)
             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 +269,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;



More information about the ffmpeg-cvslog mailing list