[PATCH 4/7] evdev: leaked_storage: EvdevInitButtonMapping: Variable "mapping" goes out of scope
Oliver McFadden
oliver.mcfadden at nokia.com
Mon Apr 19 21:11:19 PDT 2010
Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
---
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
More information about the xorg-devel
mailing list