[PATCH weston] compositor-rdp: free() can handle NULL pointers

Bryce Harrington bryce at osg.samsung.com
Sun Aug 2 03:09:18 PDT 2015


On Sat, Aug 01, 2015 at 10:03:12PM +0200, Hardening wrote:
> Le 01/08/2015 16:02, Dawid Gajownik a écrit :
> > There's no need to check if a pointer exists before passing it to free().
> > free() can handle NULL pointers.
> > 
> > Signed-off-by: Dawid Gajownik <gajownik at gmail.com>
> 
> Reviewed-By: David FORT <contact at hardening-consulting.com>

Thanks, pushed:
To ssh://git.freedesktop.org/git/wayland/weston
   2d7ded8..f965db5  master -> master

 
> > ---
> >  src/compositor-rdp.c | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> > 
> > diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
> > index a83948b..b5169a8 100644
> > --- a/src/compositor-rdp.c
> > +++ b/src/compositor-rdp.c
> > @@ -1244,12 +1244,9 @@ err_output:
> >  err_compositor:
> >  	weston_compositor_shutdown(compositor);
> >  err_free_strings:
> > -	if (b->rdp_key)
> > -		free(b->rdp_key);
> > -	if (b->server_cert)
> > -		free(b->server_cert);
> > -	if (b->server_key)
> > -		free(b->server_key);
> > +	free(b->rdp_key);
> > +	free(b->server_cert);
> > +	free(b->server_key);
> >  	free(b);
> >  	return NULL;
> >  }
> > 
> 
> 
> -- 
> David FORT
> website: http://www.hardening-consulting.com/
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list