From 3eb8a4e3251386c676c3d0696dc20837e9f58010 Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 12 Dec 2001 04:47:25 +0000 Subject: (parse_keydesc): Don't mangle the key description argument. --- ChangeLog | 5 +++++ src/actions.c | 14 +++++++++++--- 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 + + * src/actions.c (parse_keydesc): Don't mangle the key description + argument. + 2001-12-11 Ryan C Yeske * 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 -- cgit v1.2.3