Originally committed as revision 13343 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavfilter/graphparser.c (1 of 1 file). Show all
Unified · Split
| @@ -94,14 +94,15 @@ static char *consume_string(const char **buf) · 93 unmodified lines | ||
| 94 | 94 | * @arg name a pointer (that need to be free'd after use) to the name between |
| 95 | 95 | * parenthesis |
| 96 | 96 | */ |
| 97 | −static void parse_link_name(const char **buf, char **name, AVClass *log_ctx) | |
| 97 | +static char *parse_link_name(const char **buf, AVClass *log_ctx) | |
| 98 | 98 | { |
| 99 | 99 | const char *start = *buf; |
| 100 | + char *name; | |
| 100 | 101 | (*buf)++; |
| 101 | 102 | |
| 102 | − *name = consume_string(buf); | |
| 103 | + name = consume_string(buf); | |
| 103 | 104 | |
| 104 | − if(!*name[0]) { | |
| 105 | + if(!name[0]) { | |
| 105 | 106 | av_log(log_ctx, AV_LOG_ERROR, |
| 106 | 107 | "Bad (empty?) label found in the following: \"%s\".\n", start); |
| 107 | 108 | goto fail; |
| @@ -111,8 +112,10 @@ static void parse_link_name(const char **buf, char **name, AVClass *log_ctx) · 3 unmodified lines | ||
| 111 | 112 | av_log(log_ctx, AV_LOG_ERROR, |
| 112 | 113 | "Mismatched '[' found in the following: \"%s\".\n", start); |
| 113 | 114 | fail: |
| 114 | − av_freep(name); | |
| 115 | + av_freep(&name); | |
| 115 | 116 | } |
| 117 | + | |
| 118 | + return name; | |
| 116 | 119 | } |
| 117 | 120 | |
| 118 | 121 | static AVFilterContext *create_filter(AVFilterGraph *ctx, int index, |
| @@ -255,12 +258,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **currInputs, · 136 unmodified lines | ||
| 255 | 258 | int pad = 0; |
| 256 | 259 | |
| 257 | 260 | while(**buf == '[') { |
| 258 | − char *name; | |
| 261 | + char *name = parse_link_name(buf, log_ctx); | |
| 259 | 262 | AVFilterInOut *link_to_add; |
| 260 | 263 | AVFilterInOut *match; |
| 261 | 264 | |
| 262 | − parse_link_name(buf, &name, log_ctx); | |
| 263 | − | |
| 264 | 265 | if(!name) |
| 265 | 266 | return -1; |
| 266 | 267 | |
| @@ -301,14 +302,12 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 34 unmodified lines | ||
| 301 | 302 | int pad = 0; |
| 302 | 303 | |
| 303 | 304 | while(**buf == '[') { |
| 304 | − char *name; | |
| 305 | + char *name = parse_link_name(buf, log_ctx); | |
| 305 | 306 | AVFilterInOut *match; |
| 306 | 307 | |
| 307 | 308 | AVFilterInOut *input = *currInputs; |
| 308 | 309 | *currInputs = (*currInputs)->next; |
| 309 | 310 | |
| 310 | − parse_link_name(buf, &name, log_ctx); | |
| 311 | − | |
| 312 | 311 | if(!name) |
| 313 | 312 | return -1; |
| 314 | 313 | |