summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2009-01-29 17:19:42 +0100
committerMatthieu Herrb <matthieu.herrb@laas.fr>2009-01-29 17:19:42 +0100
commite98045e8101b13720690352b757cdcc3bc806b02 (patch)
treeca673abdd54bd92297a24e2c7a92098f17beaf23
parent6f3ca866c821b8fa49e2278cc1538352a95bb2a9 (diff)
Fix InputDriverRec allocation and freeing.
This caused X server to access free()'d memory on exit path. Thanks to msys.ch for providing a test machine.
-rw-r--r--src/xf86Elo.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/xf86Elo.c b/src/xf86Elo.c
index 1620e44..4ca60f1 100644
--- a/src/xf86Elo.c
+++ b/src/xf86Elo.c
@@ -970,7 +970,7 @@ not_success:
***************************************************************************
*/
static LocalDevicePtr
-xf86EloAllocate(InputDriverPtr drv)
+xf86EloAllocate(InputDriverPtr drv, IDevPtr dev)
{
LocalDevicePtr local;
EloPrivatePtr priv;
@@ -1002,7 +1002,7 @@ xf86EloAllocate(InputDriverPtr drv)
priv->packet_buf_p = 0;
priv->swap_axes = 0;
- local->name = XI_TOUCHSCREEN;
+ local->name = xstrdup(dev->identifier);
local->flags = 0 /* XI86_NO_OPEN_ON_INIT */;
local->device_control = xf86EloControl;
local->read_input = xf86EloReadInput;
@@ -1029,12 +1029,8 @@ xf86EloUninit(InputDriverPtr drv,
{
EloPrivatePtr priv = (EloPrivatePtr) local->private;
- xf86EloControl(local->dev, DEVICE_OFF);
-
xfree(priv->input_dev);
xfree(priv);
- xfree(local->name);
- xfree(local);
xf86DeleteInput(local, 0);
}
@@ -1064,7 +1060,7 @@ xf86EloInit(InputDriverPtr drv,
Model* model;
- local = xf86EloAllocate(drv);
+ local = xf86EloAllocate(drv, dev);
if (!local) {
return NULL;
}