[FFmpeg-devel] [PATCH] Make avfilter_graph_free() free the graph.

Stefano Sabatini stefano.sabatini-lala
Tue Feb 1 20:36:31 CET 2011


On date Tuesday 2011-02-01 20:29:03 +0100, Stefano Sabatini encoded:
> Make avfilter_graph_free() free not only the internal structure, but
> the allocated graph, simplify use.

> 
> (Note to the committer: bump minor or at least micro).
> ---
>  ffmpeg.c                    |    5 +----
>  ffplay.c                    |    1 -
>  libavfilter/avfiltergraph.c |    1 +
>  3 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index df89018..d2390bb 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -2698,10 +2698,7 @@ static int transcode(AVFormatContext **output_files,
>          }
>      }
>  #if CONFIG_AVFILTER
> -    if (graph) {
> -        avfilter_graph_free(graph);
> -        av_freep(&graph);
> -    }
> +    avfilter_graph_free(graph);
>  #endif

This was required as previously the code was assuming that graph was a
statically allocated struct.

Alternatively (safer) we could have:
avfilter_graph_free(&graph)

for setting to NULL the graph pointer.
-- 
FFmpeg = Faithless and Fabulous Murdering Picky Extreme Gymnast



More information about the ffmpeg-devel mailing list