malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index f3a98a8..fbaeb29 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -249,10 +249,9 @@
{
struct wayland_output *output;
- output = malloc(sizeof *output);
+ output = zalloc(sizeof *output);
if (output == NULL)
return -1;
- memset(output, 0, sizeof *output);
output->mode.flags =
WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
@@ -629,12 +628,10 @@
{
struct wayland_input *input;
- input = malloc(sizeof *input);
+ input = zalloc(sizeof *input);
if (input == NULL)
return;
- memset(input, 0, sizeof *input);
-
weston_seat_init(&input->base, &c->base, "default");
input->compositor = c;
input->seat = wl_registry_bind(c->parent.registry, id,
@@ -725,12 +722,10 @@
struct wl_event_loop *loop;
int fd;
- c = malloc(sizeof *c);
+ c = zalloc(sizeof *c);
if (c == NULL)
return NULL;
- memset(c, 0, sizeof *c);
-
if (weston_compositor_init(&c->base, display, argc, argv,
config) < 0)
goto err_free;