Commit 281caece authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/avfiltergraph: Clear graph pointers in ff_filter_graph_remove_filter()

When a filter is no longer part of a graph, its pointers should be cleared
so no stale pointers remain.
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2dc954e0
...@@ -93,12 +93,17 @@ AVFilterGraph *avfilter_graph_alloc(void) ...@@ -93,12 +93,17 @@ AVFilterGraph *avfilter_graph_alloc(void)
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter) void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
{ {
int i; int i, j;
for (i = 0; i < graph->nb_filters; i++) { for (i = 0; i < graph->nb_filters; i++) {
if (graph->filters[i] == filter) { if (graph->filters[i] == filter) {
FFSWAP(AVFilterContext*, graph->filters[i], FFSWAP(AVFilterContext*, graph->filters[i],
graph->filters[graph->nb_filters - 1]); graph->filters[graph->nb_filters - 1]);
graph->nb_filters--; graph->nb_filters--;
filter->graph = NULL;
for (j = 0; j<filter->nb_outputs; j++)
if (filter->outputs[j])
filter->outputs[j]->graph = NULL;
return; return;
} }
} }
......
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