[FFmpeg-cvslog] avfilter: check a malloc in avfilter_link().

Anton Khirnov git at videolan.org
Sat May 18 13:55:24 CEST 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Apr  1 15:44:21 2013 +0200| [7e2b15c094bb41ede9ce2a208982a20e4dfa26a6] | committer: Anton Khirnov

avfilter: check a malloc in avfilter_link().

Additionally change sizeof(type) into sizeof(var)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e2b15c094bb41ede9ce2a208982a20e4dfa26a6
---

 libavfilter/avfilter.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 95fc700..b7913a1 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;



More information about the ffmpeg-cvslog mailing list