Commited in SoC by Bobby Bingham on 2007-07-15 16:13:17 Originally committed as revision 12691 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavfilter/avfiltergraph.c (1 of 1 file). Show all
Unified · Split
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <string.h> |
| 23 | 23 | #include <stddef.h> |
| 24 | 24 | |
| 25 | +#include "avstring.h" | |
| 25 | 26 | #include "avfilter.h" |
| 26 | 27 | #include "avfiltergraph.h" |
| 27 | 28 | |
| @@ -55,16 +56,17 @@ void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) · 27 unmodified lines | ||
| 55 | 56 | graph->filters[graph->filter_count - 1] = filter; |
| 56 | 57 | } |
| 57 | 58 | |
| 58 | −static AVFilterContext *create_filter_with_args(char *filter) | |
| 59 | +static AVFilterContext *create_filter_with_args(const char *filt) | |
| 59 | 60 | { |
| 60 | 61 | AVFilterContext *ret; |
| 62 | + char *filter = av_strdup(filt); /* copy - don't mangle the input string */ | |
| 61 | 63 | char *name, *args; |
| 62 | 64 | |
| 63 | 65 | name = filter; |
| 64 | 66 | if((args = strchr(filter, '='))) { |
| 65 | 67 | /* ensure we at least have a name */ |
| 66 | 68 | if(args == filter) |
| 67 | − return NULL; | |
| 69 | + goto fail; | |
| 68 | 70 | |
| 69 | 71 | *args ++ = 0; |
| 70 | 72 | } |
| @@ -76,11 +78,15 @@ static AVFilterContext *create_filter_with_args(char *filter) · 5 unmodified lines | ||
| 76 | 78 | if(avfilter_init_filter(ret, args)) { |
| 77 | 79 | av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n"); |
| 78 | 80 | avfilter_destroy(ret); |
| 79 | − ret = NULL; | |
| 81 | + goto fail; | |
| 80 | 82 | } |
| 81 | 83 | } else av_log(NULL, AV_LOG_ERROR, "error creating filter!\n"); |
| 82 | 84 | |
| 83 | 85 | return ret; |
| 86 | + | |
| 87 | +fail: | |
| 88 | + av_free(filter); | |
| 89 | + return NULL; | |
| 84 | 90 | } |
| 85 | 91 | |
| 86 | 92 | int avfilter_graph_load_chain(AVFilterGraph *graph, |