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

Mikhail Gusarov dottedmag at dottedmag.net
Sun Jun 6 06:14:36 PDT 2010


Twas brillig at 10:03:16 06.06.2010 UTC-03 when fcarrijo at yahoo.com.br
did gyre and gimble:

 FC> 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);
 >>  }

Hmm, why? Prop is zero-initialized on allocation, so it's okay.

-- 
  http://fossarchy.blogspot.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100606/4096140e/attachment.pgp>


More information about the xorg-devel mailing list