]> git.sesse.net Git - ffmpeg/commitdiff
Make avfilter_graph_parse() not free the input graph
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 1 Feb 2011 20:52:07 +0000 (21:52 +0100)
committerMans Rullgard <mans@mansr.com>
Fri, 4 Feb 2011 02:55:11 +0000 (02:55 +0000)
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.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavfilter/graphparser.c

index 7151e4febc03472dfcd591c059d61374ee1bba46..47179e5e542116331c639fce38f279d3de0134ad 100644 (file)
@@ -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);