summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/actions.c14
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e1fb42..baa43e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-11 John Betts <hotpulp@netidea.com>
+
+ * src/actions.c (parse_keydesc): Don't mangle the key description
+ argument.
+
2001-12-11 Ryan C Yeske <rcyeske@sfu.ca>
* contrib/genrpbindings: Add ruby bindings. From Doug Kearns
diff --git a/src/actions.c b/src/actions.c
index 367968d..950c22d 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -328,16 +328,20 @@ static int string_to_keysym (char *str)
return keysym;
}
+/* Parse a key description. 's' is, naturally, the key description. */
struct rp_key*
-parse_keydesc (char *keydesc)
+parse_keydesc (char *s)
{
static struct rp_key key;
struct rp_key *p = &key;
- char *token, *next_token;
+ char *token, *next_token, *keydesc;
- if (!keydesc)
+ if (s == NULL)
return NULL;
+ /* Avoid mangling s. */
+ keydesc = xstrdup (s);
+
p->state = 0;
p->sym = 0;
@@ -354,6 +358,7 @@ parse_keydesc (char *keydesc)
if (token == NULL)
{
/* It was nothing but hyphens */
+ free (keydesc);
return NULL;
}
@@ -394,6 +399,7 @@ parse_keydesc (char *keydesc)
}
else
{
+ free (keydesc);
return NULL;
}
}
@@ -402,6 +408,8 @@ parse_keydesc (char *keydesc)
} while (next_token != NULL);
}
+ free (keydesc);
+
if (!p->sym)
return NULL;
else