[FFmpeg-devel] [PATCH] Make avfilter_graph_free() do nothing if graph is NULL.

Stefano Sabatini stefano.sabatini-lala
Wed Jan 12 19:23:19 CET 2011


---
 libavfilter/avfiltergraph.c |    2 ++
 libavfilter/avfiltergraph.h |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index cad601b..a62fe2f 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -34,6 +34,8 @@ AVFilterGraph *avfilter_graph_alloc(void)
 
 void avfilter_graph_free(AVFilterGraph *graph)
 {
+    if (!graph)
+        return;
     for (; graph->filter_count > 0; graph->filter_count --)
         avfilter_free(graph->filters[graph->filter_count - 1]);
     av_freep(&graph->scale_sws_opts);
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index 74d7a12..1b0d242 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -79,7 +79,7 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt,
 int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx);
 
 /**
- * Free a graph and destroy its links.
+ * Free a graph and destroy its links, graph may be NULL.
  */
 void avfilter_graph_free(AVFilterGraph *graph);
 
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list