summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-08-06 09:50:14 -0700
committerKristian Høgsberg <krh@bitplanet.net>2013-08-20 16:22:20 -0700
commitc0eb45286c636efcefc897894c95a284a53216d3 (patch)
tree11025d46e5510e7f8338e4ff39a38eb48b979f16 /src
parentclient: Simply wl_display_dispatch_queue_pending() and fix return value (diff)
downloadwayland-c0eb45286c636efcefc897894c95a284a53216d3.tar
wayland-c0eb45286c636efcefc897894c95a284a53216d3.tar.gz
wayland-c0eb45286c636efcefc897894c95a284a53216d3.tar.bz2
wayland-c0eb45286c636efcefc897894c95a284a53216d3.tar.lz
wayland-c0eb45286c636efcefc897894c95a284a53216d3.tar.xz
wayland-c0eb45286c636efcefc897894c95a284a53216d3.tar.zst
wayland-c0eb45286c636efcefc897894c95a284a53216d3.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/wayland-server.c8
1 files changed, 6 insertions, 2 deletions
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,