[PATCH 16/17] shell: Fix a potential NULL pointer dereference

Philip Withnall philip at tecnocode.co.uk
Mon Nov 25 10:01:45 PST 2013


From: Philip Withnall <philip.withnall at collabora.co.uk>

get_shell_surface() may return NULL. Found by scan-build.
---
 src/shell.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/shell.c b/src/shell.c
index 79ea463..1af687a 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1370,7 +1370,8 @@ take_surface_to_workspace_by_seat(struct desktop_shell *shell,
 	    workspace_has_only(to, surface))
 		update_workspace(shell, index, from, to);
 	else {
-		if (wl_list_empty(&shsurf->workspace_transform.link))
+		if (shsurf != NULL &&
+		    wl_list_empty(&shsurf->workspace_transform.link))
 			wl_list_insert(&shell->workspaces.anim_sticky_list,
 				       &shsurf->workspace_transform.link);
 
-- 
1.8.3.1



More information about the wayland-devel mailing list