Commit ba4175bc authored by vitor's avatar vitor

Handle av_realloc() failure

Commited in SoC by Vitor Sessak on 2008-04-04 15:35:38


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12754 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9fe19003
...@@ -33,11 +33,17 @@ void avfilter_destroy_graph(AVFilterGraph *graph) ...@@ -33,11 +33,17 @@ void avfilter_destroy_graph(AVFilterGraph *graph)
av_freep(&graph->filters); av_freep(&graph->filters);
} }
void avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter) int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
{ {
graph->filters = av_realloc(graph->filters, graph->filters = av_realloc(graph->filters,
sizeof(AVFilterContext*) * ++graph->filter_count); sizeof(AVFilterContext*) * ++graph->filter_count);
if (!graph->filters)
return -1;
graph->filters[graph->filter_count - 1] = filter; graph->filters[graph->filter_count - 1] = filter;
return 0;
} }
AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name) AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name)
...@@ -87,7 +93,9 @@ static int query_formats(AVFilterGraph *graph) ...@@ -87,7 +93,9 @@ static int query_formats(AVFilterGraph *graph)
return -1; return -1;
} }
avfilter_graph_add_filter(graph, scale); if (avfilter_graph_add_filter(graph, scale) < 0)
return -1;
scale->filter->query_formats(scale); scale->filter->query_formats(scale);
if(!avfilter_merge_formats(scale-> inputs[0]->in_formats, if(!avfilter_merge_formats(scale-> inputs[0]->in_formats,
scale-> inputs[0]->out_formats)|| scale-> inputs[0]->out_formats)||
......
...@@ -39,7 +39,7 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name); ...@@ -39,7 +39,7 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name);
* @param graph The filter graph * @param graph The filter graph
* @param filter The filter to be added * @param filter The filter to be added
*/ */
void avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter); int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
/** /**
* Configure the formats of all the links in the graph. * Configure the formats of all the links in the graph.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment