mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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. Originally committed as revision 22905 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
fc8fa007fb
commit
3748b2b8e8
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user