[Mesa-dev] [libdrm PATCH 3/4] nouveau/nouveau.c: Fix two memory leaks.

Marcin Slusarz marcin.slusarz at gmail.com
Thu Jun 28 14:26:25 PDT 2012


On Thu, Jun 28, 2012 at 11:11:51PM +0200, Johannes Obermayr wrote:
> Am Donnerstag, 28. Juni 2012, 23:06:10 schrieb Marcin Slusarz:
> > On Thu, Jun 28, 2012 at 09:51:57PM +0200, Johannes Obermayr wrote:
> > > ---
> > >  nouveau/nouveau.c |    2 ++
> > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
> > > index 5aa4107..e91287f 100644
> > > --- a/nouveau/nouveau.c
> > > +++ b/nouveau/nouveau.c
> > > @@ -95,6 +95,7 @@ nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)
> > >  	    (dev->drm_version <  0x01000000 ||
> > >  	     dev->drm_version >= 0x02000000)) {
> > >  		nouveau_device_del(&dev);
> > > +		free(nvdev);
> > >  		return -EINVAL;
> > >  	}
> > >  
> > > @@ -105,6 +106,7 @@ nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)
> > >  	ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_AGP_SIZE, &gart);
> > >  	if (ret) {
> > >  		nouveau_device_del(&dev);
> > > +		free(nvdev);
> > >  		return ret;
> > >  	}
> > >  
> > 
> > nouveau_device_del already does it.
> > NAK
> > 
> > Marcin
> 
> nvdev != &dev or I am wrong?

dev is a prefix of nvdev.
Just read the code...

Marcin


More information about the mesa-dev mailing list