[Mesa-dev] [PATCH] wayland-drm: add missing NULL check

Frank Binns frank.binns at imgtec.com
Fri Jun 17 17:29:41 UTC 2016


Although malloc is unlikely to fail check its return value nevertheless.

Signed-off-by: Frank Binns <frank.binns at imgtec.com>
---
 src/egl/wayland/wayland-drm/wayland-drm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index e00d9be..4fc1252 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -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);
-- 
2.7.4



More information about the mesa-dev mailing list