diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2008-09-10 20:53:43 +0200 |
---|---|---|
committer | Christoph Brill <egore911@egore911.de> | 2008-09-10 20:53:43 +0200 |
commit | 566b4dcc0b0f45ad83012314b67836ba2018cf9e (patch) | |
tree | e965ef41c3ea19b2361d6ab61e633d4f6f7cf822 | |
parent | 659c44d1049e4f6a588d40c8e0e18b390c45fa40 (diff) |
Do not use stale option list pointers
The xf86ReplaceStrOption may change the option list pointer. Also make sure
no stale option pointers are used after a call to SetDeviceAndProtocol().
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r-- | src/eventcomm.c | 3 | ||||
-rw-r--r-- | src/synaptics.c | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index 8474c54..25d0c73 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -365,7 +365,8 @@ EventAutoDevProbe(LocalDevicePtr local) touchpad_found = TRUE; xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n", local->name, fname); - xf86ReplaceStrOption(local->options, "Device", fname); + local->options = + xf86ReplaceStrOption(local->options, "Device", fname); event_query_axis_ranges(fd, local); } SYSCALL(close(fd)); diff --git a/src/synaptics.c b/src/synaptics.c index 045a051..1f96cc3 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -177,8 +177,10 @@ SetDeviceAndProtocol(LocalDevicePtr local) device = xf86FindOptionValue(local->options, "Device"); if (!device) { device = xf86FindOptionValue(local->options, "Path"); - if (device) - xf86ReplaceStrOption(local->options, "Device", device); + if (device) { + local->options = + xf86ReplaceStrOption(local->options, "Device", device); + } } if (device && strstr(device, "/dev/input/event")) { #ifdef BUILD_EVENTCOMM @@ -351,12 +353,13 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) xf86CollectInputOptions(local, NULL, NULL); - opts = local->options; - - xf86OptionListReport(opts); + xf86OptionListReport(local->options); + /* may change local->options */ SetDeviceAndProtocol(local); + opts = local->options; + /* open the touchpad device */ local->fd = xf86OpenSerial(opts); if (local->fd == -1) { |