Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-04-05 00:06:10 +0400
committerVitor Sessak <vitor1001@gmail.com>2008-04-05 00:06:10 +0400
commitfc27b8081ec79e58f3429a5d49e51fdc041f74ca (patch)
tree5ec649e39b15e69135455a404e0c06cf0d1cd7c5 /libavfilter/avfiltergraph.c
parent65a4bd9c9ecd965f7f9e01ded23abe3d7c6dfb94 (diff)
Don't mangle the input strings. The caller may want to reuse it later.
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
Diffstat (limited to 'libavfilter/avfiltergraph.c')
-rw-r--r--libavfilter/avfiltergraph.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 684da30380..034342a540 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <stddef.h>
+#include "avstring.h"
#include "avfilter.h"
#include "avfiltergraph.h"
@@ -55,16 +56,17 @@ void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
graph->filters[graph->filter_count - 1] = filter;
}
-static AVFilterContext *create_filter_with_args(char *filter)
+static AVFilterContext *create_filter_with_args(const char *filt)
{
AVFilterContext *ret;
+ char *filter = av_strdup(filt); /* copy - don't mangle the input string */
char *name, *args;
name = filter;
if((args = strchr(filter, '='))) {
/* ensure we at least have a name */
if(args == filter)
- return NULL;
+ goto fail;
*args ++ = 0;
}
@@ -76,11 +78,15 @@ static AVFilterContext *create_filter_with_args(char *filter)
if(avfilter_init_filter(ret, args)) {
av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");
avfilter_destroy(ret);
- ret = NULL;
+ goto fail;
}
} else av_log(NULL, AV_LOG_ERROR, "error creating filter!\n");
return ret;
+
+fail:
+ av_free(filter);
+ return NULL;
}
int avfilter_graph_load_chain(AVFilterGraph *graph,