diff mbox series

[FFmpeg-devel,3/8] avfilter/avfiltergraph: Avoid indirection when freeing filtergraph

Message ID AS8P250MB0744C48E2429ADE84871AA9C8F4E2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,1/8] avfilter/avfilter: Avoid allocation for AVFilterInternal | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 14, 2024, 5:25 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/avfiltergraph.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index df22de03a0..a9befb954f 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -117,23 +117,25 @@  void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter
     }
 }
 
-void avfilter_graph_free(AVFilterGraph **graph)
+void avfilter_graph_free(AVFilterGraph **graphp)
 {
-    if (!*graph)
+    AVFilterGraph *graph = *graphp;
+
+    if (!graph)
         return;
 
-    while ((*graph)->nb_filters)
-        avfilter_free((*graph)->filters[0]);
+    while (graph->nb_filters)
+        avfilter_free(graph->filters[0]);
 
-    ff_graph_thread_free(*graph);
+    ff_graph_thread_free(graph);
 
-    av_freep(&(*graph)->sink_links);
+    av_freep(&graph->sink_links);
 
-    av_opt_free(*graph);
+    av_opt_free(graph);
 
-    av_freep(&(*graph)->filters);
-    av_freep(&(*graph)->internal);
-    av_freep(graph);
+    av_freep(&graph->filters);
+    av_freep(&graph->internal);
+    av_freep(graphp);
 }
 
 int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt,