From: U. Artie Eoff Date: Wed, 15 Jan 2014 18:59:50 +0000 (-0800) Subject: clients/desktop-shell: check OOM conditions X-Git-Tag: upstream/0.1.8~491 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c946779df0063ffc5ce7e649b8670a24824c99c;p=profile%2Fivi%2Fweston-ivi-shell.git clients/desktop-shell: check OOM conditions Signed-off-by: U. Artie Eoff --- diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 4e7a815..a0c6b6d 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -21,12 +21,15 @@ * OF THIS SOFTWARE. */ +#include "config.h" + #include #include #include #include #include #include +#include #include #include #include @@ -609,7 +612,7 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path) launcher = xzalloc(sizeof *launcher); launcher->icon = load_icon_or_fallback(icon); - launcher->path = strdup(path); + launcher->path = xstrdup(path); wl_array_init(&launcher->envp); wl_array_init(&launcher->argv); @@ -1061,6 +1064,11 @@ background_create(struct desktop *desktop) weston_config_section_get_string(s, "background-type", &type, "tile"); + if (type == NULL) { + fprintf(stderr, "%s: out of memory\n", program_invocation_short_name); + exit(EXIT_FAILURE); + } + if (strcmp(type, "scale") == 0) { background->type = BACKGROUND_SCALE; } else if (strcmp(type, "scale-crop") == 0) {