From: Kristian Høgsberg Date: Tue, 6 Aug 2013 16:50:14 +0000 (-0700) Subject: server: Handle OOM properly when we fail to allocate a send closure X-Git-Tag: 1.2.91~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b0cabfc48cf4c13fec95f749d3b44050fe9ff79;p=platform%2Fupstream%2Fwayland.git server: Handle OOM properly when we fail to allocate a send closure If we can't allocate a closure, don't just silently continue. Set client->error so we shut down the client when we're done processing events. --- diff --git a/src/wayland-server.c b/src/wayland-server.c index 0a6e112..b74f87a 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -136,8 +136,10 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...) &object->interface->events[opcode]); va_end(ap); - if (closure == NULL) + if (closure == NULL) { + resource->client->error = 1 return; + } if (wl_closure_send(closure, resource->client->connection)) wl_event_loop_add_idle(resource->client->display->loop, @@ -162,8 +164,10 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...) &object->interface->events[opcode]); va_end(ap); - if (closure == NULL) + if (closure == NULL) { + resource->client->error = 1 return; + } if (wl_closure_queue(closure, resource->client->connection)) wl_event_loop_add_idle(resource->client->display->loop,