diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-07-17 12:48:31 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-07-17 12:48:31 -0700 |
commit | b57637a154a40e874a6bcb351aaa8335e86ae3c0 (patch) | |
tree | 5de33f32cc554f1c9c1cc8ab313a04132478bca6 | |
parent | 72a01c6a3bae2cf113ab0ec812df41fec9b99a51 (diff) |
Coverity #678: get_keysym_list: Returned without freeing storage "keysymlist"
Free allocated memory in error path when it's not being returned
-rw-r--r-- | handle.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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); } } |