aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2008-04-04 20:09:47 +0000
committerVitor Sessak <vitor1001@gmail.com>2008-04-04 20:09:47 +0000
commit4e4a3e2314b34a0d55167626c1e737cdaa66126b (patch)
tree274ffc25d46383df9b93000f1c2c3787c3774b93 /libavfilter
parent51bf654d796cb59834f050adcccf1ba6bba2abe7 (diff)
downloadffmpeg-4e4a3e2314b34a0d55167626c1e737cdaa66126b.tar.gz
Handle av_realloc() failure
Commited in SoC by Vitor Sessak on 2008-04-04 15:35:38 Originally committed as revision 12754 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/avfiltergraph.c12
-rw-r--r--libavfilter/avfiltergraph.h2
2 files changed, 11 insertions, 3 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 7e040a4f4f..ccb275c6f9 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -33,11 +33,17 @@ void avfilter_destroy_graph(AVFilterGraph *graph)
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,
sizeof(AVFilterContext*) * ++graph->filter_count);
+
+ if (!graph->filters)
+ return -1;
+
graph->filters[graph->filter_count - 1] = filter;
+
+ return 0;
}
AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name)
@@ -87,7 +93,9 @@ static int query_formats(AVFilterGraph *graph)
return -1;
}
- avfilter_graph_add_filter(graph, scale);
+ if (avfilter_graph_add_filter(graph, scale) < 0)
+ return -1;
+
scale->filter->query_formats(scale);
if(!avfilter_merge_formats(scale-> inputs[0]->in_formats,
scale-> inputs[0]->out_formats)||
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index e529af9ff7..dbfad4fcc7 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -39,7 +39,7 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name);
* @param graph The filter graph
* @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.