--- libavfilter/vf_scale.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 759499395f..8516919556 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -328,16 +328,24 @@ static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts) return 0; } +static void scaler_free(ScaleContext *s) +{ + sws_freeContext(s->sws); + sws_freeContext(s->isws[0]); + sws_freeContext(s->isws[1]); + + s->sws = NULL; + s->isws[0] = NULL; + s->isws[1] = NULL; +} + static av_cold void uninit(AVFilterContext *ctx) { ScaleContext *scale = ctx->priv; av_expr_free(scale->w_pexpr); av_expr_free(scale->h_pexpr); scale->w_pexpr = scale->h_pexpr = NULL; - sws_freeContext(scale->sws); - sws_freeContext(scale->isws[0]); - sws_freeContext(scale->isws[1]); - scale->sws = NULL; + scaler_free(scale); av_dict_free(&scale->opts); } @@ -512,13 +520,8 @@ static int config_props(AVFilterLink *outlink) if (outfmt == AV_PIX_FMT_PAL8) outfmt = AV_PIX_FMT_BGR8; scale->output_is_pal = av_pix_fmt_desc_get(outfmt)->flags & AV_PIX_FMT_FLAG_PAL; - if (scale->sws) - sws_freeContext(scale->sws); - if (scale->isws[0]) - sws_freeContext(scale->isws[0]); - if (scale->isws[1]) - sws_freeContext(scale->isws[1]); - scale->isws[0] = scale->isws[1] = scale->sws = NULL; + scaler_free(scale); + if (inlink0->w == outlink->w && inlink0->h == outlink->h && !scale->out_color_matrix && -- 2.30.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".