Signed-off-by: Oliver McFadden <[email protected]>
---
src/evdev.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/evdev.c b/src/evdev.c
index 9fe952e..6992c68 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1371,15 +1371,16 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
/* Check for user-defined button mapping */
if ((mapping = xf86CheckStrOption(pInfo->options, "ButtonMapping", NULL)))
{
- char *s = " ";
+ char *map, *s = " ";
int btn = 0;
xf86Msg(X_CONFIG, "%s: ButtonMapping '%s'\n", pInfo->name, mapping);
+ map = mapping;
while (s && *s != '\0' && nbuttons < EVDEV_MAXBUTTONS)
{
- btn = strtol(mapping, &s, 10);
+ btn = strtol(map, &s, 10);
- if (s == mapping || btn < 0 || btn > EVDEV_MAXBUTTONS)
+ if (s == map || btn < 0 || btn > EVDEV_MAXBUTTONS)
{
xf86Msg(X_ERROR,
"%s: ... Invalid button mapping. Using defaults\n",
@@ -1389,8 +1390,9 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
}
pEvdev->btnmap[nbuttons++] = btn;
- mapping = s;
+ map = s;
}
+ xfree(mapping);
}
for (i = nbuttons; i < ArrayLength(pEvdev->btnmap); i++)
--
1.6.1
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel