]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_mix.c
avfilter: add estdif video filter
[ffmpeg] / libavfilter / vf_mix.c
index 9e1ae79e007f0b40702875b0643c8f492bf32acd..bdb67d8e5ac9c49d0011079899ec74929285f9b2 100644 (file)
@@ -108,7 +108,10 @@ static av_cold int init(AVFilterContext *ctx)
             break;
 
         p = NULL;
-        av_sscanf(arg, "%f", &s->weights[i]);
+        if (av_sscanf(arg, "%f", &s->weights[i]) != 1) {
+            av_log(ctx, AV_LOG_ERROR, "Invalid syntax for weights[%d].\n", i);
+            return AVERROR(EINVAL);
+        }
         s->wfactor += s->weights[i];
         last = i;
     }
@@ -289,7 +292,7 @@ static av_cold void uninit(AVFilterContext *ctx)
         for (i = 0; i < ctx->nb_inputs; i++)
             av_freep(&ctx->input_pads[i].name);
     } else {
-        for (i = 0; i < s->nb_frames; i++)
+        for (i = 0; i < s->nb_frames && s->frames; i++)
             av_frame_free(&s->frames[i]);
     }
     av_freep(&s->frames);