aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-06 15:20:30 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-11 15:15:53 +0100
commitb229dce2e4c2db9f52808978a114e711f38aa75c (patch)
treea449f28e04ec9a7f09357928e115bb5f2a53ad95
parent952c62f658a58f2047ea7e2506d59c0947755f35 (diff)
downloadffmpeg-b229dce2e4c2db9f52808978a114e711f38aa75c.tar.gz
avfilter/vf_w3fdif: Fix segfault on allocation error
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit cd1aaec760273bd7673b27609f114599e2d9b5a9)
-rw-r--r--libavfilter/vf_w3fdif.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c
index 1a64b2b953..d380fdd4de 100644
--- a/libavfilter/vf_w3fdif.c
+++ b/libavfilter/vf_w3fdif.c
@@ -283,7 +283,7 @@ static int config_input(AVFilterLink *inlink)
AVFilterContext *ctx = inlink->dst;
W3FDIFContext *s = ctx->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
- int ret, i, depth;
+ int ret, i, depth, nb_threads;
if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
return ret;
@@ -297,10 +297,11 @@ static int config_input(AVFilterLink *inlink)
}
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
- s->nb_threads = ff_filter_get_nb_threads(ctx);
- s->work_line = av_calloc(s->nb_threads, sizeof(*s->work_line));
+ nb_threads = ff_filter_get_nb_threads(ctx);
+ s->work_line = av_calloc(nb_threads, sizeof(*s->work_line));
if (!s->work_line)
return AVERROR(ENOMEM);
+ s->nb_threads = nb_threads;
for (i = 0; i < s->nb_threads; i++) {
s->work_line[i] = av_calloc(FFALIGN(s->linesize[0], 32), sizeof(*s->work_line[0]));