[Mesa-dev] [PATCH] egl/x11: Remove unneeded free() on always null string

Vadym Shovkoplias vadym.shovkoplias at globallogic.com
Fri Dec 1 16:03:49 UTC 2017


Hi Eric,

Mostly by a static analysis tool. It found at least 7 issues with useless
free() calls and other problems that probably should be fixed.
Suggest please should I create one cumulative commit for this or it should
be a separate commits ?

On Fri, Dec 1, 2017 at 5:41 PM, Eric Engestrom <eric.engestrom at imgtec.com>
wrote:

> On Friday, 2017-12-01 17:08:53 +0200, vadim.shovkoplias at gmail.com wrote:
> > From: Vadym Shovkoplias <vadym.shovkoplias at globallogic.com>
> >
> > In this condition dri2_dpy->driver_name string always equals
> > NULL, so call to free() is useless
> >
> > Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias at globallogic.com>
>
> Reviewed and pushed :)
>
> Are you finding all of these by inspection, or are you using a tool?
>
> > ---
> >  src/egl/drivers/dri2/platform_x11.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/
> platform_x11.c
> > index c49cb1f..8ede590b 100644
> > --- a/src/egl/drivers/dri2/platform_x11.c
> > +++ b/src/egl/drivers/dri2/platform_x11.c
> > @@ -704,7 +704,6 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
> >
> >     if (dri2_dpy->driver_name == NULL) {
> >        close(dri2_dpy->fd);
> > -      free(dri2_dpy->driver_name);
> >        free(connect);
> >        return EGL_FALSE;
> >     }
> > --
> > 2.7.4
> >
>



-- 

Vadym Shovkoplias | Software engineer
GlobalLogic
P +x.xxx.xxx.xxxx  M +3.8050.931.7304  S vadym.shovkoplias
www.globallogic.com
<http://www.globallogic.com/>
http://www.globallogic.com/email_disclaimer.txt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171201/ae892459/attachment.html>


More information about the mesa-dev mailing list