[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    Re: [PATCH xwayland 1/2] xwayland: fix memory leak
From:       Marek Chalupa <mchqwerty () gmail ! com>
Date:       2015-11-27 13:59:08
Message-ID: 565861AC.4030202 () gmail ! com
[Download RAW message or body]



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@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
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic