summaryrefslogtreecommitdiff
path: root/libavfilter/avfiltergraph.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-27 13:40:34 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-27 16:30:25 +0200
commit281caece46c4a82c8c4c49b0847867e3be053a85 (patch)
tree3b9e2c5e23c4eaf8f97b874feae3ea701d50a6a5 /libavfilter/avfiltergraph.c
parent2dc954e0bd54db891cae362fa99b2ad7992d7294 (diff)
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: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/avfiltergraph.c')
-rw-r--r--libavfilter/avfiltergraph.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 9f50b4120d..42751132af 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -93,12 +93,17 @@ AVFilterGraph *avfilter_graph_alloc(void)
void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter)
{
- int i;
+ int i, j;
for (i = 0; i < graph->nb_filters; i++) {
if (graph->filters[i] == filter) {
FFSWAP(AVFilterContext*, graph->filters[i],
graph->filters[graph->nb_filters - 1]);
graph->nb_filters--;
+ filter->graph = NULL;
+ for (j = 0; j<filter->nb_outputs; j++)
+ if (filter->outputs[j])
+ filter->outputs[j]->graph = NULL;
+
return;
}
}