[PATCH 4/5] xf86SbusCmapLoadPalette: Delay malloc until needed, avoiding leak on error

Keith Packard keithp at keithp.com
Mon Apr 8 11:27:48 PDT 2013

Alan Coopersmith <alan.coopersmith at oracle.com> writes:

> Reported with other leaks found by cppcheck in bugzilla #50281
> https://bugs.freedesktop.org/show_bug.cgi?id=50281

> -    fbcmap.red = data;
> +    fbcmap.red = data = malloc(numColors * 3);

I'd hate to leave the obviously missing check for malloc failure here though.

keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20130408/b16d4bfb/attachment.pgp>

More information about the xorg-devel mailing list