From b886212545df6b1d0deed0cfff29aa72ac04c449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 25 Jul 2013 16:44:45 -0700 Subject: [PATCH] Use xmalloc in desktop-shell.c --- clients/desktop-shell.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 1062901c5..eb550c8d0 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -409,7 +409,7 @@ panel_add_clock(struct panel *panel) return; } - clock = malloc(sizeof *clock); + clock = xmalloc(sizeof *clock); memset(clock, 0, sizeof *clock); clock->panel = panel; panel->clock = clock; @@ -512,7 +512,7 @@ panel_create(struct desktop *desktop) struct panel *panel; struct weston_config_section *s; - panel = malloc(sizeof *panel); + panel = xmalloc(sizeof *panel); memset(panel, 0, sizeof *panel); panel->base.configure = panel_configure; @@ -582,7 +582,7 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path) char *start, *p, *eq, **ps; int i, j, k; - launcher = malloc(sizeof *launcher); + launcher = xmalloc(sizeof *launcher); memset(launcher, 0, sizeof *launcher); launcher->icon = load_icon_or_fallback(icon); launcher->path = strdup(path); @@ -841,9 +841,7 @@ unlock_dialog_create(struct desktop *desktop) struct display *display = desktop->display; struct unlock_dialog *dialog; - dialog = malloc(sizeof *dialog); - if (!dialog) - return NULL; + dialog = xmalloc(sizeof *dialog); memset(dialog, 0, sizeof *dialog); dialog->window = window_create_custom(display); @@ -989,7 +987,7 @@ background_create(struct desktop *desktop) struct weston_config_section *s; char *type; - background = malloc(sizeof *background); + background = xmalloc(sizeof *background); memset(background, 0, sizeof *background); background->base.configure = background_configure;