screen-share: Avoid NULL dereference
authorDaniel Stone <daniels@collabora.com>
Thu, 16 Feb 2017 19:59:50 +0000 (19:59 +0000)
committerBryce Harrington <bryce@osg.samsung.com>
Tue, 21 Feb 2017 20:27:08 +0000 (12:27 -0800)
Don't try to dereference the seat if it's NULL.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
compositor/screen-share.c

index bcb9def..069da1d 100644 (file)
@@ -192,7 +192,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
        char *map_str;
 
        if (!data)
-               goto error;
+               goto error_no_seat;
 
        if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
                map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
@@ -235,6 +235,7 @@ ss_seat_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
 
 error:
        wl_keyboard_release(seat->parent.keyboard);
+error_no_seat:
        close(fd);
 }