[FFmpeg-devel] [PATCH] lavfi: avfilter_merge_formats: handle case where inputs are same.
Mina Nagy Zaki
mnzaki at gmail.com
Thu Jun 9 11:11:00 CEST 2011
On Thursday 09 June 2011 12:37:18 Stefano Sabatini wrote:
> On date Thursday 2011-06-09 11:10:09 +0300, Mina Nagy Zaki encoded:
> > ---
> >
> > libavfilter/formats.c | 2 ++
> > 1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> > index ec7fca3..58593fc 100644
> > --- a/libavfilter/formats.c
> > +++ b/libavfilter/formats.c
> > @@ -44,6 +44,8 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats
> > *a, AVFilterFormats *b)
> >
> > AVFilterFormats *ret;
> > unsigned i, j, k = 0;
> >
> > + if (a == b) return a;
> > +
> >
> > ret = av_mallocz(sizeof(AVFilterFormats));
> >
> > /* merge list of formats */
>
> Looks OK (I'd just add a note in the commit message that this is not
> changing behavior, but just optimizing the case where the two merged
> lists are the same one). I'll apply soon if I see no comments.
To be more clear, this actually fixes a double-free crash if lists are the same
due to the two merge_ref() calls at the end of the (useless) merging that
happens.
--
Mina
More information about the ffmpeg-devel
mailing list