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
22#include <string.h>22#include <string.h>
23#include <stddef.h>23#include <stddef.h>
24 24
25#include "avstring.h"
25#include "avfilter.h"26#include "avfilter.h"
26#include "avfiltergraph.h"27#include "avfiltergraph.h"
27 28
@@ -55,16 +56,17 @@ void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) · 27 unmodified lines
55 graph->filters[graph->filter_count - 1] = filter;56 graph->filters[graph->filter_count - 1] = filter;
56}57}
57 58
58static AVFilterContext *create_filter_with_args(char *filter)59static AVFilterContext *create_filter_with_args(const char *filt)
59{60{
60 AVFilterContext *ret;61 AVFilterContext *ret;
62 char *filter = av_strdup(filt); /* copy - don't mangle the input string */
61 char *name, *args;63 char *name, *args;
62 64
63 name = filter;65 name = filter;
64 if((args = strchr(filter, '='))) {66 if((args = strchr(filter, '='))) {
65 /* ensure we at least have a name */67 /* ensure we at least have a name */
66 if(args == filter)68 if(args == filter)
67 return NULL;69 goto fail;
68 70
69 *args ++ = 0;71 *args ++ = 0;
70 }72 }
@@ -76,11 +78,15 @@ static AVFilterContext *create_filter_with_args(char *filter) · 5 unmodified lines
76 if(avfilter_init_filter(ret, args)) {78 if(avfilter_init_filter(ret, args)) {
77 av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");79 av_log(NULL, AV_LOG_ERROR, "error initializing filter!\n");
78 avfilter_destroy(ret);80 avfilter_destroy(ret);
79 ret = NULL;81 goto fail;
80 }82 }
81 } else av_log(NULL, AV_LOG_ERROR, "error creating filter!\n");83 } else av_log(NULL, AV_LOG_ERROR, "error creating filter!\n");
82 84
83 return ret;85 return ret;
86
87fail:
88 av_free(filter);
89 return NULL;
84}90}
85 91
86int avfilter_graph_load_chain(AVFilterGraph *graph,92int 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