OSDN Git Service

avfilter: check a malloc in avfilter_link().
authorAnton Khirnov <anton@khirnov.net>
Mon, 1 Apr 2013 13:44:21 +0000 (15:44 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 17 May 2013 18:32:27 +0000 (20:32 +0200)
Additionally change sizeof(type) into sizeof(var)

libavfilter/avfilter.c

index 95fc700..b7913a1 100644 (file)
@@ -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;