1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

config: Plug some memory leaks in error handling.

This commit is contained in:
Kalle Olavi Niemitalo 2008-02-02 21:05:49 +02:00 committed by Kalle Olavi Niemitalo
parent 4960c65f20
commit c92cd01e0b

View File

@ -229,7 +229,7 @@ parse_bind(struct option *opt_tree, unsigned char **file, int *line,
keystroke = option_types[OPT_STRING].read(NULL, file, line); keystroke = option_types[OPT_STRING].read(NULL, file, line);
*file = skip_white(*file, line); *file = skip_white(*file, line);
if (!keystroke || !**file) { if (!keystroke || !**file) {
mem_free(keymap); mem_free(keymap); mem_free(keystroke);
return ERROR_OPTION; return ERROR_OPTION;
} }
@ -251,7 +251,7 @@ parse_bind(struct option *opt_tree, unsigned char **file, int *line,
next_pos = *file; next_pos = *file;
action = option_types[OPT_STRING].read(NULL, file, line); action = option_types[OPT_STRING].read(NULL, file, line);
if (!action) { if (!action) {
mem_free(keymap); mem_free(keymap); mem_free(keystroke);
return ERROR_VALUE; return ERROR_VALUE;
} }
@ -295,7 +295,10 @@ parse_include(struct option *opt_tree, unsigned char **file, int *line,
if (!init_string(&dumbstring)) return ERROR_NOMEM; if (!init_string(&dumbstring)) return ERROR_NOMEM;
*file = skip_white(*file, line); *file = skip_white(*file, line);
if (!*file) return ERROR_PARSE; if (!*file) {
done_string(&dumbstring);
return ERROR_PARSE;
}
/* File name */ /* File name */
fname = option_types[OPT_STRING].read(NULL, file, line); fname = option_types[OPT_STRING].read(NULL, file, line);