diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 95fc700dc2..b7913a12cc 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -87,8 +87,11 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, return AVERROR(EINVAL); } - src->outputs[srcpad] = - dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink)); + link = av_mallocz(sizeof(*link)); + if (!link) + return AVERROR(ENOMEM); + + src->outputs[srcpad] = dst->inputs[dstpad] = link; link->src = src; link->dst = dst;