Commit fa43cf8e authored by stefano's avatar stefano

Fix leak in avfilter_graph_add_filter().

In case of reallocation failure the pointer to the original filter
array was lost. The correct behavior seems to just keep the old array
and count.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22905 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 351f25b7
......@@ -36,13 +36,13 @@ void avfilter_graph_destroy(AVFilterGraph *graph)
int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
{
graph->filters = av_realloc(graph->filters,
sizeof(AVFilterContext*) * ++graph->filter_count);
if (!graph->filters)
AVFilterContext **filters = av_realloc(graph->filters,
sizeof(AVFilterContext*) * (graph->filter_count+1));
if (!filters)
return AVERROR(ENOMEM);
graph->filters[graph->filter_count - 1] = filter;
graph->filters = filters;
graph->filters[graph->filter_count++] = filter;
return 0;
}
......
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