diff options
author | Adam Jackson <ajax@redhat.com> | 2009-04-16 11:49:12 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-16 11:49:12 +1000 |
commit | b56ab7e0140c8fa7dcc58f6b8a087f7d6bece04f (patch) | |
tree | 8e28ef4ff75b6ebab39364b82db89b252db8c247 | |
parent | 74bd8574c796c7ff7c9bea6873b317bf14d29a70 (diff) |
Allocate the timer early so we don't try to malloc it within a sigio handler.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/synaptics.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/synaptics.c b/src/synaptics.c index ddefecf..2383c38 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -511,9 +511,17 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) if (!priv) return NULL; + /* allocate now so we don't allocate in the signal handler */ + priv->timer = TimerSet(NULL, 0, 0, NULL, NULL); + if (!priv->timer) { + xfree(priv); + return NULL; + } + /* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */ local = xf86AllocateInput(drv, 0); if (!local) { + xfree(priv->timer); xfree(priv); return NULL; } @@ -614,6 +622,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) if (priv->comm.buffer) XisbFree(priv->comm.buffer); free_param_data(priv); + xfree(priv->timer); xfree(priv); local->private = NULL; return local; @@ -627,6 +636,7 @@ static void SynapticsUnInit(InputDriverPtr drv, InputInfoPtr local, int flags) { + xfree(((SynapticsPrivate *)local->private)->timer); xfree(local->private); local->private = NULL; xf86DeleteInput(local, 0); |