avfilter/af_merge: check ff_insert_inpad() for failure
authorPaul B Mahol <onemda@gmail.com>
Fri, 25 Aug 2017 07:50:57 +0000 (09:50 +0200)
committerPaul B Mahol <onemda@gmail.com>
Fri, 25 Aug 2017 07:50:57 +0000 (09:50 +0200)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavfilter/af_amerge.c

index cc974cd..09c660e 100644 (file)
@@ -322,7 +322,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
 static av_cold int init(AVFilterContext *ctx)
 {
     AMergeContext *s = ctx->priv;
-    int i;
+    int i, ret;
 
     s->in = av_calloc(s->nb_inputs, sizeof(*s->in));
     if (!s->in)
@@ -336,7 +336,10 @@ static av_cold int init(AVFilterContext *ctx)
         };
         if (!name)
             return AVERROR(ENOMEM);
-        ff_insert_inpad(ctx, i, &pad);
+        if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
+            av_freep(&pad.name);
+            return ret;
+        }
     }
     return 0;
 }