[PATCH] Make avfilter_graph_parse() do not free the input graph.

Stefano Sabatini stefano.sabatini-lala
Tue Feb 1 21:52:07 CET 2011


Make avfilter_graph_parse() only release the internal structures
allocated during the parsing, and leave to free the graph itself to
the calling code.

This approach looks cleaner, as the graph is not allocated by the
function.
---
 libavfilter/graphparser.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 7151e4f..47179e5 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -393,7 +393,9 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
     return 0;
 
  fail:
-    avfilter_graph_free(graph);
+    for (; graph->filter_count > 0; graph->filter_count--)
+        avfilter_free(graph->filters[graph->filter_count - 1]);
+    av_freep(&graph->filters);
     free_inout(open_inputs);
     free_inout(open_outputs);
     free_inout(curr_inputs);
-- 
1.7.2.3


--ibTvN161/egqYuK8
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0004-Make-avfilter_graph_free-free-the-graph.patch"




More information about the ffmpeg-devel mailing list