]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avfiltergraph.c
Ensure that the filter_count member is reset to zero when emptying the graph
[ffmpeg] / libavfilter / avfiltergraph.c
index d4b6bf1b871bb0c9a1d16f36e3b48df6e0ea9e3e..684da30380db436ea9142f2af79f3e90e760a4d9 100644 (file)
@@ -37,10 +37,8 @@ AVFilterGraph *avfilter_create_graph(void)
 
 static void destroy_graph_filters(AVFilterGraph *graph)
 {
-    unsigned i;
-
-    for(i = 0; i < graph->filter_count; i ++)
-        avfilter_destroy(graph->filters[i]);
+    for(; graph->filter_count > 0; graph->filter_count --)
+        avfilter_destroy(graph->filters[graph->filter_count - 1]);
     av_freep(&graph->filters);
 }