[PATCH xwayland 1/2] xwayland: fix memory leak

Marek Chalupa mchqwerty at gmail.com
Fri Nov 27 05:59:08 PST 2015



On 11/23/2015 11:40 AM, Olivier Fourdan wrote:
> On 23/11/15 11:18, Marek Chalupa wrote:
>> don't leak memory when realizing window fails
>>
>> Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
>> ---
>>   hw/xwayland/xwayland.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
>> index e31becf..56b03f6 100644
>> --- a/hw/xwayland/xwayland.c
>> +++ b/hw/xwayland/xwayland.c
>> @@ -238,6 +238,7 @@ xwl_realize_window(WindowPtr window)
>>       xwl_window->surface =
>> wl_compositor_create_surface(xwl_screen->compositor);
>>       if (xwl_window->surface == NULL) {
>>           ErrorF("wl_display_create_surface failed\n");
>> +        free(xwl_window);
>>           return FALSE;
>>       }
>
> While at it, I think we should also check for calloc() returned value
> just above for xwl_window.

True,
let's do it thoroughly

> Cheers,
> Olivier


More information about the xorg-devel mailing list