diff options
author | Diego Nieto Cid <dnietoc@gmail.com> | 2011-04-06 17:18:23 -0300 |
---|---|---|
committer | Diego Nieto Cid <dnietoc@gmail.com> | 2011-04-16 23:45:25 -0300 |
commit | aa415b240011948e792de71ee46df1a496a13c57 (patch) | |
tree | 45482a0367bf04379b6fa6afeed6b81e605ce8c6 /console-client/xkb/parser.y | |
parent | 3d534c36b1f423ee98c17efe57ab560096f60eb1 (diff) |
Deallocate memory on errors.
* console-client/xkb/parser.y(parse_xkbconfig): Free cwd.
Diffstat (limited to 'console-client/xkb/parser.y')
-rw-r--r-- | console-client/xkb/parser.y | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/console-client/xkb/parser.y b/console-client/xkb/parser.y index 48009457..845fcbaf 100644 --- a/console-client/xkb/parser.y +++ b/console-client/xkb/parser.y @@ -1567,6 +1567,7 @@ parse_xkbconfig (char *xkbdir, char *xkbkeymapfile, char *xkbkeymap) { fprintf (stderr, "Could not set \"%s\" as the active directory\n", xkbdir); + free (cwd); return errno; } @@ -1574,6 +1575,7 @@ parse_xkbconfig (char *xkbdir, char *xkbkeymapfile, char *xkbkeymap) if (yyin == NULL) { fprintf (stderr, "Couldn't open keymap file\n"); + free (cwd); return errno; } @@ -1591,7 +1593,10 @@ parse_xkbconfig (char *xkbdir, char *xkbkeymapfile, char *xkbkeymap) fclose (yyin); if (err || yynerrs > 0) - return EINVAL; + { + free (cwd); + return EINVAL; + } if (xkbkeymapfile) { @@ -1599,6 +1604,7 @@ parse_xkbconfig (char *xkbdir, char *xkbkeymapfile, char *xkbkeymap) { fprintf (stderr, "Could not set \"%s\" as the active directory\n", cwd); + free (cwd); return errno; } } |