summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--handle.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index 1cb2a43..fe5b6ac 100644
--- a/handle.c
+++ b/handle.c
@@ -972,6 +972,7 @@ get_keysym_list(char *line, int len, int *np, KeySym **kslistp)
n = skip_chars (line, len);
if (n < 0) {
badmsg0 ("keysym name list");
+ free(keysymlist);
return (-1);
}
@@ -990,12 +991,14 @@ get_keysym_list(char *line, int len, int *np, KeySym **kslistp)
/* grow the list bigger if necessary */
if (havesofar >= maxcanhave) {
+ KeySym *origkeysymlist = keysymlist;
maxcanhave *= 2;
keysymlist = (KeySym *) realloc (keysymlist,
maxcanhave * sizeof (KeySym));
if (!keysymlist) {
badmsg ("attempt to grow keysym list to %ld bytes",
(long) (maxcanhave * sizeof (KeySym)));
+ free(origkeysymlist);
return (-1);
}
}