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.
Showing the changes to libavfilter/avfiltergraph.h (1 of 4 files). Show all
Unified · Split
| @@ -79,9 +79,10 @@ int avfilter_graph_create_filter(AVFilterContext **filt_ctx, AVFilter *filt, · 78 unmodified lines | ||
| 79 | 79 | int avfilter_graph_config(AVFilterGraph *graphctx, AVClass *log_ctx); |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | − * Free a graph and destroy its links, graph may be NULL. | |
| 82 | + * Free a graph, destroy its links, and set *graph to NULL. | |
| 83 | + * If *graph is NULL, do nothing. | |
| 83 | 84 | */ |
| 84 | −void avfilter_graph_free(AVFilterGraph *graph); | |
| 85 | +void avfilter_graph_free(AVFilterGraph **graph); | |
| 85 | 86 | |
| 86 | 87 | /** |
| 87 | 88 | * A linked-list of the inputs/outputs of the filter chain. |