diff --git a/dbus.c b/dbus.c index 93193db..2080639 100644 --- a/dbus.c +++ b/dbus.c @@ -1,10 +1,14 @@ /* copyright 2013 Sascha Kruse and contributors (see LICENSE for licensing information) */ +#include +#include #include +#include #include #include "dunst.h" #include "dbus.h" #include "notification.h" +#include "utils.h" GDBusConnection *dbus_conn; @@ -124,6 +128,9 @@ static void onNotify(GDBusConnection * connection, gchar *summary = NULL; gchar *body = NULL; Actions *actions = malloc(sizeof(Actions)); + if(actions == NULL) { + die("Unable to allocate memory", EXIT_FAILURE); + } gint timeout = -1; /* hints */ @@ -268,6 +275,9 @@ static void onNotify(GDBusConnection * connection, } notification *n = malloc(sizeof(notification)); + if(n == NULL) { + die("Unable to allocate memory", EXIT_FAILURE); + } n->appname = appname; n->summary = summary; n->body = body; diff --git a/dunst.c b/dunst.c index 74c3fcc..493803d 100644 --- a/dunst.c +++ b/dunst.c @@ -319,6 +319,9 @@ int main(int argc, char *argv[]) if (settings.startup_notification) { notification *n = malloc(sizeof(notification)); + if(n == NULL) { + die("Unable to allocate memory", EXIT_FAILURE); + } n->appname = strdup("dunst"); n->summary = strdup("startup"); n->body = strdup("dunst is up and running"); diff --git a/x.c b/x.c index f0b6ca0..62ecde9 100644 --- a/x.c +++ b/x.c @@ -330,6 +330,9 @@ static cairo_surface_t *get_icon_surface(char *icon_path) static colored_layout *r_init_shared(cairo_t *c, notification *n) { colored_layout *cl = 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) {