summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-10-01 14:03:56 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-10-01 14:58:46 +0300
commite972b27f34e78c55d6f1b23a3c54bc14f2945287 (patch)
treeac2113693147856f7651a4da2057872f5c1140ae
parentef2b592ad4b6503ed80e287fd0f2c3ae173a5e3e (diff)
shell: don't crash on create_common_surface() failure
Noticed while reading code, that create_common_surface() may return NULL, and callers of its direct callers check for NULL, but the intermediate function in between would crash. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--desktop-shell/shell.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 6ef36b5b..810961f8 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3879,6 +3879,9 @@ create_xdg_surface(struct shell_client *owner, void *shell,
struct shell_surface *shsurf;
shsurf = create_common_surface(owner, shell, surface, client);
+ if (!shsurf)
+ return NULL;
+
shsurf->type = SHELL_SURFACE_TOPLEVEL;
return shsurf;
@@ -3963,6 +3966,9 @@ create_xdg_popup(struct shell_client *owner, void *shell,
struct shell_surface *shsurf;
shsurf = create_common_surface(owner, shell, surface, client);
+ if (!shsurf)
+ return NULL;
+
shsurf->type = SHELL_SURFACE_POPUP;
shsurf->popup.shseat = seat;
shsurf->popup.serial = serial;