wayland-drm: add missing NULL check
authorFrank Binns <frank.binns@imgtec.com>
Thu, 4 Aug 2016 14:15:40 +0000 (15:15 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 1 Sep 2016 14:48:52 +0000 (15:48 +0100)
Although malloc is unlikely to fail check its return value nevertheless.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/wayland/wayland-drm/wayland-drm.c

index e00d9be6a9185098d1f442fcf412cd79204780e6..4fc12521d249019e6ec6b79dc60479670f488da5 100644 (file)
@@ -265,6 +265,8 @@ wayland_drm_init(struct wl_display *display, char *device_name,
        struct wl_drm *drm;
 
        drm = malloc(sizeof *drm);
+       if (!drm)
+               return NULL;
 
        drm->display = display;
        drm->device_name = strdup(device_name);