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-headless.c b/src/compositor-headless.c
index dd33242..4a0cc7f 100644
--- a/src/compositor-headless.c
+++ b/src/compositor-headless.c
@@ -95,10 +95,9 @@
struct headless_output *output;
struct wl_event_loop *loop;
- 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;
@@ -161,12 +160,10 @@
{
struct headless_compositor *c;
- c = calloc(1, 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;