[FFmpeg-devel] [PATCH] Make avfilter_graph_free() free the graph.
Stefano Sabatini
stefano.sabatini-lala
Tue Feb 1 22:03:34 CET 2011
On date Tuesday 2011-02-01 21:15:17 +0100, Michael Niedermayer encoded:
> On Tue, Feb 01, 2011 at 08:36:31PM +0100, Stefano Sabatini wrote:
> > 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.
>
> agree, and LGTM
Updated accordingly.
First patch is required by the second, for preventing a crash.
(Note to the committers: update minor).
--
FFmpeg = Fabulous Friendly Mean Ponderous Embarassing Gadget
More information about the ffmpeg-devel
mailing list