[PATCH] Remove more superfluous if(p) checks around free(p)

Fernando Carrijo fcarrijo at yahoo.com.br
Sun Jun 6 06:03:16 PDT 2010


Mikhail Gusarov <dottedmag at dottedmag.net> wrote:
> This patch has been generated by the following Coccinelle semantic patch:
> 
> @@
> expression E;
> @@
> 
> -if(E) { free(E); }
> +free(E);
> 
> Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>

Reviewed-by: Fernando Carrijo <fcarrijo at yahoo.com.br>

By the way, the hunk below sounds rather fishy, right?

> @@ -109,14 +107,10 @@ RRCreateOutputProperty (Atom property)
>  static void
>  RRDestroyOutputProperty (RRPropertyPtr prop)
>  {
> -    if (prop->valid_values)
> -	free(prop->valid_values);
> -    if (prop->current.data)
> -	free(prop->current.data);
> -    if (prop->pending.data)
> -	free(prop->pending.data);
> -    if (prop->valid_values)
> -	free(prop->valid_values);
> +    free(prop->valid_values);
> +    free(prop->current.data);
> +    free(prop->pending.data);
> +    free(prop->valid_values);
>      free(prop);
>  }

But yeah, it's matter for an unrelated patch.



More information about the xorg-devel mailing list