[FFmpeg-soc] [soc]: r2116 - libavfilter/graphparser.c

vitor subversion at mplayerhq.hu
Thu Apr 10 20:35:09 CEST 2008


Author: vitor
Date: Thu Apr 10 20:35:09 2008
New Revision: 2116

Log:
Better error messages

Modified:
   libavfilter/graphparser.c

Modified: libavfilter/graphparser.c
==============================================================================
--- libavfilter/graphparser.c	(original)
+++ libavfilter/graphparser.c	Thu Apr 10 20:35:09 2008
@@ -139,20 +139,27 @@ static char *consume_string(const char *
  */
 static void parse_link_name(const char **buf, char **name)
 {
+    const char *start = *buf;
     (*buf)++;
 
     *name = consume_string(buf);
 
-    if(!*name[0])
+    if(!*name[0]) {
+        av_log(&log_ctx, AV_LOG_ERROR,
+               "Bad (empty?) label found in the following: \"%s\".\n", start);
         goto fail;
+    }
 
-    if(*(*buf)++ != ']')
+    if(*(*buf)++ != ']') {
+        av_log(&log_ctx, AV_LOG_ERROR,
+               "Mismatched '[' found in the following: \"%s\".\n", start);
         goto fail;
+    }
 
     return;
+
  fail:
     av_freep(name);
-    av_log(&log_ctx, AV_LOG_ERROR, "Could not parse link name!\n");
 }
 
 /**
@@ -212,6 +219,12 @@ static int parse_inouts(const char **buf
     while (**buf == '[') {
         AVFilterInOut *inoutn = av_malloc(sizeof(AVFilterInOut));
         parse_link_name(buf, &inoutn->name);
+
+        if (!inoutn->name) {
+            av_free(inoutn);
+            return -1;
+        }
+
         inoutn->type = type;
         inoutn->filter = filter;
         inoutn->pad_idx = pad++;
@@ -263,6 +276,9 @@ int avfilter_parse_graph(AVFilterGraph *
 
         pad = parse_inouts(&inouts, &inout, chr == ',', LinkTypeIn, filter);
 
+        if(pad < 0)
+            goto fail;
+
         // If the first filter has an input and none was given, it is
         // implicitly the input of the whole graph.
         if(pad == 0 && filter->input_count == 1) {



More information about the FFmpeg-soc mailing list