[PATCH 3/3] RRModeCreate: plug memory leak of newModes if AddResource fails

Keith Packard keithp at keithp.com
Wed Jul 25 09:18:16 PDT 2012


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

> Reported by parfait 1.0:
>
> Error: Memory leak (CWE 401)
>    Memory leak of pointer 'newModes' allocated with realloc(((char*)modes), ((num_modes + 1) * 8))
>         at line 93 of randr/rrmode.c in function 'RRModeCreate'.
>           pointer allocated at line 82 with realloc(((char*)modes), ((num_modes + 1) * 8)).
> Error: Memory leak (CWE 401)
>    Memory leak of pointer 'newModes' allocated with malloc(8)
>         at line 93 of randr/rrmode.c in function 'RRModeCreate'.
>           pointer allocated at line 84 with malloc(8).

Reviewed-by: Keith Packard <keithp at keithp.com>

-- 
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/20120725/2b16f657/attachment.pgp>


More information about the xorg-devel mailing list