Move destruction of the graph's filters to its own helper function.
[ffmpeg.git] / libavfilter / avfiltergraph.c
index 7b9d963..4e5bfd2 100644 (file)
@@ -32,13 +32,18 @@ AVFilterGraph *avfilter_create_graph(void)
     return av_mallocz(sizeof(AVFilterGraph));
 }
 
     return av_mallocz(sizeof(AVFilterGraph));
 }
 
-void avfilter_destroy_graph(AVFilterGraph *graph)
+static void destroy_graph_filters(AVFilterGraph *graph)
 {
     unsigned i;
 
     for(i = 0; i < graph->filter_count; i ++)
         avfilter_destroy(graph->filters[i]);
 {
     unsigned i;
 
     for(i = 0; i < graph->filter_count; i ++)
         avfilter_destroy(graph->filters[i]);
-    av_free(graph->filters);
+    av_freep(&graph->filters);
+}
+
+void avfilter_destroy_graph(AVFilterGraph *graph)
+{
+    destroy_graph_filters(graph);
     av_free(graph);
 }
 
     av_free(graph);
 }