diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-04-18 20:10:43 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-04-18 20:10:43 +0000 |
commit | 3748b2b8e8bcedba2de7fe826c4094169a885840 (patch) | |
tree | 54ef012e409fe11f89ac64402e69864b63ad8d56 /libavfilter | |
parent | fc8fa007fb6099643a1f742a162e5e5eda760fd6 (diff) | |
download | ffmpeg-3748b2b8e8bcedba2de7fe826c4094169a885840.tar.gz |
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
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/avfiltergraph.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 2fcf73ab5c..9ad6536306 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -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; } |