From 2a9a52b913f0d409c97e63418accda4a65c265aa Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 14 Jan 2020 16:07:35 +0100 Subject: [PATCH] avfilter/af_afir: check if frame clone is set --- libavfilter/af_afir.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 077f9c7962..7c7e8458d4 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -670,8 +670,12 @@ static int activate(AVFilterContext *ctx) int64_t new_pts = av_rescale_q(s->pts, ctx->inputs[0]->time_base, ctx->outputs[1]->time_base); if (ff_outlink_frame_wanted(ctx->outputs[1]) && old_pts < new_pts) { + AVFrame *clone; s->video->pts = new_pts; - return ff_filter_frame(ctx->outputs[1], av_frame_clone(s->video)); + clone = av_frame_clone(s->video); + if (!clone) + return AVERROR(ENOMEM); + return ff_filter_frame(ctx->outputs[1], clone); } }