if (wordlen == 0) {
warnx("%s: line %zd: no option found",
filename, lineno);
- return (1);
+ goto out;
}
optind = -1;
for (i = 0; i < LENGTH(configopt); i++) {
if (optind == -1) {
warnx("%s: line %zd: unknown option %.*s",
filename, lineno, wordlen, cp);
- return (1);
+ goto out;
}
if (keymapping && strcmp(opt->optname, "bind")) {
warnx("%s: line %zd: invalid option %.*s",
filename, lineno, wordlen, cp);
- return (1);
+ goto out;
}
cp += wordlen;
cp += strspn(cp, " \t\n"); /* eat whitespace */
if (wordlen == 0) {
warnx("%s: line %zd: syntax error",
filename, lineno);
- return (1);
+ goto out;
}
asprintf(&optsub, "%.*s", wordlen, cp);
}
DNPRINTF(SWM_D_CONF, "conf_load end\n");
return (0);
+
+out:
+ free(line);
+ fclose(config);
+
+ return (1);
}
void