From 7e2b15c094bb41ede9ce2a208982a20e4dfa26a6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 1 Apr 2013 15:44:21 +0200 Subject: [PATCH] avfilter: check a malloc in avfilter_link(). Additionally change sizeof(type) into sizeof(var) --- libavfilter/avfilter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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;