History

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

Vitor Sessak committed 18 years ago

Commit fc27b801 parent 65a4bd91 file · +9 −3Browse files

Unified · Split

libavfilter/avfiltergraph.c+9−3
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <string.h>
2323 #include <stddef.h>
2424
25+#include "avstring.h"
2526 #include "avfilter.h"
2627 #include "avfiltergraph.h"
2728
@@ -55,16 +56,17 @@ void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) · 27 unmodified lines
5556 graph->filters[graph->filter_count - 1] = filter;
5657 }
5758
58−static AVFilterContext *create_filter_with_args(char *filter)
59+static AVFilterContext *create_filter_with_args(const char *filt)
5960 {
6061 AVFilterContext *ret;
62+ char *filter = av_strdup(filt); /* copy - don't mangle the input string */
6163 char *name, *args;
6264
6365 name = filter;
6466 if((args = strchr(filter, '='))) {
6567 /* ensure we at least have a name */
6668 if(args == filter)
67− return NULL;
69+ goto fail;
6870
6971 *args ++ = 0;
7072 }
@@ -76,11 +78,15 @@ static AVFilterContext *create_filter_with_args(char *filter) · 5 unmodified lines
7678 if(avfilter_init_filter(ret, args)) {
7779 av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");
7880 avfilter_destroy(ret);
79− ret = NULL;
81+ goto fail;
8082 }
8183 } else av_log(NULL, AV_LOG_ERROR, "error creating filter!\n");
8284
8385 return ret;
86+
87+fail:
88+ av_free(filter);
89+ return NULL;
8490 }
8591
8692 int avfilter_graph_load_chain(AVFilterGraph *graph,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t