From aa415b240011948e792de71ee46df1a496a13c57 Mon Sep 17 00:00:00 2001 From: Diego Nieto Cid Date: Wed, 6 Apr 2011 17:18:23 -0300 Subject: Deallocate memory on errors. * console-client/xkb/parser.y(parse_xkbconfig): Free cwd. --- console-client/xkb/parser.y | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'console-client/xkb') 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; } } -- cgit v1.2.3