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

Hardening rdp.effort at gmail.com
Sat Aug 1 13:03:12 PDT 2015


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>

> ---
>  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/



More information about the wayland-devel mailing list