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

Olivier Fourdan ofourdan at redhat.com
Mon Nov 23 02:40:37 PST 2015


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.

Cheers,
Olivier


More information about the xorg-devel mailing list