From 6920a42fd4ec8dfa633ef5bc1865f994afc63693 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 22 Jan 2016 18:08:44 +1000 Subject: [PATCH] tablet: fix potential null-pointer dereference Found by coverity Signed-off-by: Peter Hutterer --- src/evdev-tablet.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index ae205501..e684055b 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -875,6 +875,8 @@ tablet_get_tool(struct tablet_dispatch *tablet, const struct input_absinfo *pressure; tool = zalloc(sizeof *tool); + if (!tool) + return NULL; *tool = (struct libinput_tablet_tool) { .type = type, .serial = serial, @@ -1295,6 +1297,9 @@ tablet_flush(struct tablet_dispatch *tablet, tablet->current_tool_id, tablet->current_tool_serial); + if (!tool) + return; /* OOM */ + if (tool->type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE || tool->type == LIBINPUT_TABLET_TOOL_TYPE_LENS) tablet_update_proximity_state(tablet, device, tool);