summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2013-03-28 18:48:09 +0000
committerKristian Høgsberg <krh@bitplanet.net>2013-04-01 17:16:29 -0400
commit8680c67c478d13de757268120494a89b120cf881 (patch)
treef993fe1f07fe3fea94a890c93430ee421ef50518
parent728b64189b76d5953af89644e1259d4299555807 (diff)
wayland-server: Avoid deferencing a NULL pointer in error case
Reorder the error handling in the case that closure is NULL due to ENOMEM to ensure that we can safely call wl_closure_lookup_objects on the second test. Prior to this reordering the closure would be deferenced in the ENOMEM case due to the invocation of the second half of the logical OR check.
-rw-r--r--src/wayland-server.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index dcb4435..384b465 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -260,8 +260,11 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
&client->objects, message);
len -= size;
- if ((closure == NULL && errno == EINVAL) ||
- wl_closure_lookup_objects(closure, &client->objects) < 0) {
+ if (closure == NULL && errno == ENOMEM) {
+ wl_resource_post_no_memory(resource);
+ break;
+ } else if ((closure == NULL && errno == EINVAL) ||
+ wl_closure_lookup_objects(closure, &client->objects) < 0) {
wl_resource_post_error(client->display_resource,
WL_DISPLAY_ERROR_INVALID_METHOD,
"invalid arguments for %s@%u.%s",
@@ -269,9 +272,6 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
object->id,
message->name);
break;
- } else if (closure == NULL && errno == ENOMEM) {
- wl_resource_post_no_memory(resource);
- break;
}
if (wl_debug)