[PATCH 4/4] Coverity: mi/mispans.c: leaked_storage: Variable "newpoints" and "newwidths" goes out of scope

Oliver McFadden oliver.mcfadden at nokia.com
Mon Dec 28 02:30:09 PST 2009


On Mon, 2009-12-28 at 11:09 +0100, ext Mikhail Gusarov wrote:
> Twas brillig at 12:02:58 28.12.2009 UTC+02 when oliver.mcfadden at nokia.com did gyre and gimble:
> 
>  OM> + if (newpoints)
>  OM> +     xfree (newpoints);
> 
> Which is equivalent to
> 
> if (newpoints)
>   if (newpoints)
>     free(newpoints);
> 
> And free(3) already handles NULL pointer safely: "If ptr is NULL, no
> operation is performed."

Okay, in that case this patch just becomes adding the two lines:

xfree (newpoints);
xfree (newwidths);

and we don't need to care about any checking of our own. I'll send the
v2 patch.

-- Oliver.



More information about the xorg-devel mailing list