diff --git a/src/dbus.c b/src/dbus.c index 04b69d0..cd24158 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -131,10 +131,7 @@ static void on_notify(GDBusConnection * connection, gchar *icon = NULL; gchar *summary = NULL; gchar *body = NULL; - Actions *actions = g_malloc(sizeof(Actions)); - if(actions == NULL) { - die("Unable to allocate memory", EXIT_FAILURE); - } + Actions *actions = g_malloc0(sizeof(Actions)); gint timeout = -1; /* hints */ @@ -145,10 +142,6 @@ static void on_notify(GDBusConnection * connection, gchar *category = NULL; RawImage *raw_icon = NULL; - actions->actions = NULL; - actions->count = 0; - actions->dmenu_str = NULL; - { GVariantIter *iter = g_variant_iter_new(parameters); GVariant *content; diff --git a/src/notification.c b/src/notification.c index 45332c5..a08bd1d 100644 --- a/src/notification.c +++ b/src/notification.c @@ -323,10 +323,7 @@ char *notification_extract_markup_urls(char **str_ptr) { */ notification *notification_create(void) { - notification *n = g_malloc(sizeof(notification)); - if(n == NULL) die("Unable to allocate memory", EXIT_FAILURE); - memset(n, 0, sizeof(notification)); - return n; + return g_malloc0(sizeof(notification)); } void notification_init_defaults(notification *n) diff --git a/src/x.c b/src/x.c index 766813c..62dbce7 100644 --- a/src/x.c +++ b/src/x.c @@ -385,9 +385,6 @@ static GdkPixbuf *get_pixbuf_from_raw_image(const RawImage *raw_image) static colored_layout *r_init_shared(cairo_t *c, notification *n) { colored_layout *cl = g_malloc(sizeof(colored_layout)); - if(cl == NULL) { - die("Unable to allocate memory", EXIT_FAILURE); - } cl->l = pango_cairo_create_layout(c); if (!settings.word_wrap) {