[FFmpeg-devel] [PATCH] Make avfilter_graph_free() free the graph.

Stefano Sabatini stefano.sabatini-lala
Tue Feb 1 20:29:03 CET 2011


Make avfilter_graph_free() free not only the internal structure, but
the allocated graph, simplify use.

(Note to the committer: bump minor or at least micro).
---
 ffmpeg.c                    |    5 +----
 ffplay.c                    |    1 -
 libavfilter/avfiltergraph.c |    1 +
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index df89018..d2390bb 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2698,10 +2698,7 @@ static int transcode(AVFormatContext **output_files,
         }
     }
 #if CONFIG_AVFILTER
-    if (graph) {
-        avfilter_graph_free(graph);
-        av_freep(&graph);
-    }
+    avfilter_graph_free(graph);
 #endif
 
     /* finished ! */
diff --git a/ffplay.c b/ffplay.c
index 1fb7502..6cb22c6 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1900,7 +1900,6 @@ static int video_thread(void *arg)
  the_end:
 #if CONFIG_AVFILTER
     avfilter_graph_free(graph);
-    av_freep(&graph);
 #endif
     av_free(frame);
     return 0;
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index a62fe2f..3f1fb86 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -40,6 +40,7 @@ void avfilter_graph_free(AVFilterGraph *graph)
         avfilter_free(graph->filters[graph->filter_count - 1]);
     av_freep(&graph->scale_sws_opts);
     av_freep(&graph->filters);
+    av_free(graph);
 }
 
 int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list