[FFmpeg-cvslog] avfilter/avfiltergraph: Clear graph pointers in ff_filter_graph_remove_filter()

Michael Niedermayer git at videolan.org
Fri May 27 16:32:46 CEST 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri May 27 13:40:34 2016 +0200| [281caece46c4a82c8c4c49b0847867e3be053a85] | committer: 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: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=281caece46c4a82c8c4c49b0847867e3be053a85
---

 libavfilter/avfiltergraph.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 9f50b41..4275113 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;
         }
     }



More information about the ffmpeg-cvslog mailing list