Use zalloc instead of calloc(1, ...)
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
diff --git a/src/text-backend.c b/src/text-backend.c
index e9578a4..6246b30 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -357,7 +357,9 @@
struct text_input_manager *text_input_manager = wl_resource_get_user_data(resource);
struct text_input *text_input;
- text_input = calloc(1, sizeof *text_input);
+ text_input = zalloc(sizeof *text_input);
+ if (text_input == NULL)
+ return;
text_input->resource =
wl_resource_create(client, &wl_text_input_interface, 1, id);
@@ -409,7 +411,9 @@
{
struct text_input_manager *text_input_manager;
- text_input_manager = calloc(1, sizeof *text_input_manager);
+ text_input_manager = zalloc(sizeof *text_input_manager);
+ if (text_input_manager == NULL)
+ return;
text_input_manager->ec = ec;
@@ -726,7 +730,7 @@
if (!input_method->input_method_binding)
return;
- context = calloc(1, sizeof *context);
+ context = zalloc(sizeof *context);
if (context == NULL)
return;
@@ -913,7 +917,9 @@
struct input_method *input_method;
struct weston_compositor *ec = seat->compositor;
- input_method = calloc(1, sizeof *input_method);
+ input_method = zalloc(sizeof *input_method);
+ if (input_method == NULL)
+ return;
input_method->seat = seat;
input_method->model = NULL;
@@ -972,7 +978,9 @@
{
struct text_backend *text_backend;
- text_backend = calloc(1, sizeof(*text_backend));
+ text_backend = zalloc(sizeof(*text_backend));
+ if (text_backend == NULL)
+ return -1;
text_backend->compositor = ec;