Fix allocation and freeing of InputDriverRec, so that X doesn't dump core

on exit. Found thanks to msys test machine.
This commit is contained in:
matthieu 2009-01-29 16:18:44 +00:00
parent 8f8b86d413
commit 1faf8dcd02

View File

@ -970,7 +970,7 @@ not_success:
*************************************************************************** ***************************************************************************
*/ */
static LocalDevicePtr static LocalDevicePtr
xf86EloAllocate(InputDriverPtr drv) xf86EloAllocate(InputDriverPtr drv, IDevPtr dev)
{ {
LocalDevicePtr local; LocalDevicePtr local;
EloPrivatePtr priv; EloPrivatePtr priv;
@ -1002,7 +1002,7 @@ xf86EloAllocate(InputDriverPtr drv)
priv->packet_buf_p = 0; priv->packet_buf_p = 0;
priv->swap_axes = 0; priv->swap_axes = 0;
local->name = XI_TOUCHSCREEN; local->name = xstrdup(dev->identifier);
local->flags = 0 /* XI86_NO_OPEN_ON_INIT */; local->flags = 0 /* XI86_NO_OPEN_ON_INIT */;
local->device_control = xf86EloControl; local->device_control = xf86EloControl;
local->read_input = xf86EloReadInput; local->read_input = xf86EloReadInput;
@ -1029,12 +1029,8 @@ xf86EloUninit(InputDriverPtr drv,
{ {
EloPrivatePtr priv = (EloPrivatePtr) local->private; EloPrivatePtr priv = (EloPrivatePtr) local->private;
xf86EloControl(local->dev, DEVICE_OFF);
xfree(priv->input_dev); xfree(priv->input_dev);
xfree(priv); xfree(priv);
xfree(local->name);
xfree(local);
xf86DeleteInput(local, 0); xf86DeleteInput(local, 0);
} }
@ -1064,7 +1060,7 @@ xf86EloInit(InputDriverPtr drv,
Model* model; Model* model;
local = xf86EloAllocate(drv); local = xf86EloAllocate(drv, dev);
if (!local) { if (!local) {
return NULL; return NULL;
} }