On Thu, 15 May 2014 13:03:50 -0700 "U. Artie Eoff" <ullysses.a.e...@intel.com> wrote:
> Signed-off-by: U. Artie Eoff <ullysses.a.e...@intel.com> > --- > src/text-backend.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/src/text-backend.c b/src/text-backend.c > index d6a6f3b..362a3fa 100644 > --- a/src/text-backend.c > +++ b/src/text-backend.c > @@ -358,6 +358,8 @@ static void text_input_manager_create_text_input(struct > wl_client *client, > struct text_input *text_input; > > text_input = calloc(1, sizeof *text_input); > + if (text_input == NULL) > + return; Silent failure here is a no-go, it confuses the client, as server vs. client state on what objects exist disagrees, and the client will get a random protocol error eventually. Better to just use wl_resource_post_no_memory() here to kill the client immediately. > > text_input->resource = > wl_resource_create(client, &wl_text_input_interface, 1, id); > @@ -411,6 +413,9 @@ text_input_manager_create(struct weston_compositor *ec) > > text_input_manager = calloc(1, sizeof *text_input_manager); > > + if (text_input_manager == NULL) > + return; We're already pretty screwed if this fails anyway, but is hiding the failure ok? > + > text_input_manager->ec = ec; > > text_input_manager->text_input_manager_global = wl_global_create() could fail, too. > @@ -917,6 +922,9 @@ handle_seat_created(struct wl_listener *listener, > > input_method = calloc(1, sizeof *input_method); > > + if (input_method == NULL) > + return; > + Ditto. > input_method->seat = seat; > input_method->model = NULL; > input_method->focus_listener_initialized = 0; > @@ -969,6 +977,9 @@ text_backend_init(struct weston_compositor *ec) > > text_backend = calloc(1, sizeof(*text_backend)); > > + if (text_backend == NULL) > + return -1; > + > text_backend->compositor = ec; > > text_backend->seat_created_listener.notify = handle_seat_created; Looks like lots of places are just hiding failures instead of communicating them to the caller, or at least yelling about it. Still, wl_resource_post_no_memory() is the only thing I'd want to see fixed in this patch before it gets in, the others are not so important as they are not client-triggerable. Thanks, pq _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel