[Intel-gfx] [PATCH i-g-t 3/7] lib: Stop igt_get_all_cairo_formats memory leak

Brian Starkey brian.starkey at arm.com
Tue Apr 25 19:29:48 UTC 2017


On Tue, Apr 25, 2017 at 02:43:13PM -0300, Gabriel Krisman Bertazi wrote:
>Brian Starkey <brian.starkey at arm.com> writes:
>
>> igt_get_all_cairo_formats() allocates the format list on the heap, but
>> returns it in a const pointer. Change this so that callers can free the
>> array without a warning, and free the array in all callers.
>>
>> Signed-off-by: Brian Starkey <brian.starkey at arm.com>
>> ---
>
>Hi,
>
>Assuming I'm not missing anything, I think if you free formats here, the
>static variable in igt_get_all_cairo_formats() will point to garbage and
>further calls to that function will return uninitialized memory.
>

Hi!

Yes, sorry you're quite right. I'd managed to completely miss the fact
the pointer is static.

Please ignore this patch then,

Thanks,
Brian
>
>
>-- 
>Gabriel Krisman Bertazi


More information about the Intel-gfx mailing list