History

Make avfilter_graph_free() free the graph.

Make avfilter_graph_free() free not only the internal structures, but also the allocated graph, and set the graph pointer to NULL for increased safety. Simplify usage.

Stefano Sabatini committed 15 years ago

Commit 43592881 parent e8e5dde4 files · +12 −14Browse files

Showing the changes to libavfilter/avfiltergraph.c (1 of 4 files). Show all

Unified · Split

libavfilter/avfiltergraph.c+7−6
@@ -32,14 +32,15 @@ AVFilterGraph *avfilter_graph_alloc(void) · 31 unmodified lines
3232 return av_mallocz(sizeof(AVFilterGraph));
3333 }
3434
35−void avfilter_graph_free(AVFilterGraph *graph)
35+void avfilter_graph_free(AVFilterGraph **graph)
3636 {
37− if (!graph)
37+ if (!*graph)
3838 return;
39− for (; graph->filter_count > 0; graph->filter_count --)
40− avfilter_free(graph->filters[graph->filter_count - 1]);
41− av_freep(&graph->scale_sws_opts);
42− av_freep(&graph->filters);
39+ for (; (*graph)->filter_count > 0; (*graph)->filter_count--)
40+ avfilter_free((*graph)->filters[(*graph)->filter_count - 1]);
41+ av_freep(&(*graph)->scale_sws_opts);
42+ av_freep(&(*graph)->filters);
43+ av_freep(graph);
4344 }
4445
4546 int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t