Some stability and cleanup patches.
[openwrt/svn-archive/archive.git] / Xorg / driver / xf86-input-tslib / patches / 012-deleteinput.patch
1 commit de4ec145ea88253dc469ee81f094fa73de36b773
2 Author: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Sun Feb 1 16:54:55 2009 +0100
4
5 Call xf86DeleteInput in UnInit or if something goes wrong in the Init procedure.
6 If xf86DeleteInput is not called the server will end up with corrupted memory.
7
8 diff --git a/src/tslib.c b/src/tslib.c
9 index ad43abb..3eba078 100644
10 --- a/src/tslib.c
11 +++ b/src/tslib.c
12 @@ -271,6 +271,7 @@ xf86TslibUninit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
13 #endif
14 xf86TslibControlProc(pInfo->dev, DEVICE_OFF);
15 xfree(pInfo->private);
16 + xf86DeleteInput(pInfo, 0);
17 }
18
19 /*
20 @@ -347,15 +348,17 @@ xf86TslibInit(InputDriverPtr drv, IDevPtr dev, int flags)
21 s = xf86SetStrOption(pInfo->options, "Device", NULL);
22
23 priv->ts = ts_open(s, 0);
24 + xfree(s);
25 +
26 if (!priv->ts) {
27 ErrorF("ts_open failed (device=%s)\n",s);
28 + xf86DeleteInput(pInfo, 0);
29 return NULL;
30 }
31
32 - xfree(s);
33 -
34 if (ts_config(priv->ts)) {
35 ErrorF("ts_config failed\n");
36 + xf86DeleteInput(pInfo, 0);
37 return NULL;
38 }
39