tablet: fix potential null-pointer dereference

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2016-01-22 18:08:44 +10:00
parent a6b43386d6
commit 6920a42fd4

View file

@ -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);