[FFmpeg-devel] [PATCH] fix few compiler warnings
Michael Niedermayer
michael at niedermayer.cc
Wed Jun 15 13:47:37 CEST 2016
On Fri, Jun 03, 2016 at 12:56:36AM +0000, Davinder Singh wrote:
> On Thu, Jun 2, 2016 at 5:18 PM Michael Niedermayer <michael at niedermayer.cc>
> wrote:
>
> > On Sun, May 22, 2016 at 01:51:05AM +0000, Davinder Singh wrote:
> > [...]
> >
> > > vf_hwdownload.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > 5eb7416fececde847414f37de9a78a4e1cd5e1af
> > 0004-libavfilter-vf_hwdownload-show-error-when-ff_formats.patch
> > > From d1d00989a374facba3cdf777d95c61bf385f1332 Mon Sep 17 00:00:00 2001
> > > From: dsmudhar <ds.mudhar at gmail.com>
> > > Date: Sun, 22 May 2016 06:26:36 +0530
> > > Subject: [PATCH 4/7] libavfilter/vf_hwdownload: show error when
> > ff_formats_ref
> > > fails
> > >
> > > ---
> > > libavfilter/vf_hwdownload.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavfilter/vf_hwdownload.c b/libavfilter/vf_hwdownload.c
> > > index 2dcc9fa..79ea82d 100644
> > > --- a/libavfilter/vf_hwdownload.c
> > > +++ b/libavfilter/vf_hwdownload.c
> > > @@ -56,8 +56,10 @@ static int hwdownload_query_formats(AVFilterContext
> > *avctx)
> > > }
> > > }
> > >
> > > - ff_formats_ref(infmts, &avctx->inputs[0]->out_formats);
> > > - ff_formats_ref(outfmts, &avctx->outputs[0]->in_formats);
> > > + if ((err = ff_formats_ref(infmts, &avctx->inputs[0]->out_formats))
> > < 0 ||
> > > + (err = ff_formats_ref(outfmts, &avctx->outputs[0]->in_formats))
> > < 0)
> > > + return err;
> >
> > according to coverity this introduces a memleak
> > (1362184)
> > ill send you an invite so you can take a look
> >
> > [...]
> >
> > --
> > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > Those who are too smart to engage in politics are punished by being
> > governed by those who are dumber. -- Plato
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
> this patch should fix it
>
> Thanks,
> DSM_
> vf_hwdownload.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
> 7b9bf5b1d20562c575b6aa815e47e8a22a888ccb 0001-vf_hwdownload-fix-memory-leak.patch
> From 2cdac9e4bc4b66294a561776f0284499d4971282 Mon Sep 17 00:00:00 2001
> From: dsmudhar <ds.mudhar at gmail.com>
> Date: Fri, 3 Jun 2016 06:19:25 +0530
> Subject: [PATCH] vf_hwdownload: fix memory leak
>
> ---
> libavfilter/vf_hwdownload.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/libavfilter/vf_hwdownload.c b/libavfilter/vf_hwdownload.c
> index 79ea82d..f012356 100644
> --- a/libavfilter/vf_hwdownload.c
> +++ b/libavfilter/vf_hwdownload.c
> @@ -49,18 +49,20 @@ static int hwdownload_query_formats(AVFilterContext *avctx)
> err = ff_add_format(&infmts, av_pix_fmt_desc_get_id(desc));
> else
> err = ff_add_format(&outfmts, av_pix_fmt_desc_get_id(desc));
> - if (err) {
> - ff_formats_unref(&infmts);
> - ff_formats_unref(&outfmts);
> - return err;
> - }
> + if (err < 0)
> + goto fail;
> }
>
> if ((err = ff_formats_ref(infmts, &avctx->inputs[0]->out_formats)) < 0 ||
> (err = ff_formats_ref(outfmts, &avctx->outputs[0]->in_formats)) < 0)
> - return err;
> + goto fail;
>
> return 0;
> +
> +fail:
> + ff_formats_unref(&infmts);
> + ff_formats_unref(&outfmts);
this could unref infmts even after successfull ff_formats_ref(infmts, ...
which would cause problems i think
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160615/df9050e8/attachment.sig>
More information about the ffmpeg-devel
mailing list