Revision 4359288c

View differences:

ffmpeg.c
2698 2698
        }
2699 2699
    }
2700 2700
#if CONFIG_AVFILTER
2701
    if (graph) {
2702
        avfilter_graph_free(graph);
2703
        av_freep(&graph);
2704
    }
2701
    avfilter_graph_free(&graph);
2705 2702
#endif
2706 2703

  
2707 2704
    /* finished ! */
ffplay.c
1899 1899
    }
1900 1900
 the_end:
1901 1901
#if CONFIG_AVFILTER
1902
    avfilter_graph_free(graph);
1903
    av_freep(&graph);
1902
    avfilter_graph_free(&graph);
1904 1903
#endif
1905 1904
    av_free(frame);
1906 1905
    return 0;
libavfilter/avfiltergraph.c
32 32
    return av_mallocz(sizeof(AVFilterGraph));
33 33
}
34 34

  
35
void avfilter_graph_free(AVFilterGraph *graph)
35
void avfilter_graph_free(AVFilterGraph **graph)
36 36
{
37
    if (!graph)
37
    if (!*graph)
38 38
        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);
43 44
}
44 45

  
45 46
int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
libavfilter/avfiltergraph.h
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.

Also available in: Unified diff