[FFmpeg-devel] [PATCH] lavfi/unsharp: add missing NULL check

Stefano Sabatini stefasab at gmail.com
Sat Feb 16 01:06:14 CET 2013


On date Friday 2013-02-15 19:15:50 +0000, Paul B Mahol encoded:
> On 2/15/13, Stefano Sabatini <stefasab at gmail.com> wrote:
> > ---
> >  libavfilter/vf_unsharp.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
> > index 51f44c8..e8f162b 100644
> > --- a/libavfilter/vf_unsharp.c
> > +++ b/libavfilter/vf_unsharp.c
> > @@ -211,7 +211,8 @@ static int init_filter_param(AVFilterContext *ctx,
> > FilterParam *fp, const char *
> >             effect, effect_type, fp->msize_x, fp->msize_y, fp->amount /
> > 65535.0);
> >
> >      for (z = 0; z < 2 * fp->steps_y; z++)
> > -        fp->sc[z] = av_malloc(sizeof(*(fp->sc[z])) * (width + 2 *
> > fp->steps_x));
> > +        if (!(fp->sc[z] = av_malloc(sizeof(*(fp->sc[z])) * (width + 2 *
> > fp->steps_x))))
> > +            return AVERROR(ENOMEM);
[...]

> Is leak possible? LGTM anyway.

In theory when configure() fails, uninit() is called and the allocated
memory should be freed there.
-- 
FFmpeg = Forgiving and Fundamentalist Mortal Portable Exxagerate Geek


More information about the ffmpeg-devel mailing list