mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-03-15 03:53:48 +00:00
config parser: missing fclose()
This commit is contained in:
@@ -68,6 +68,7 @@ conf_parse_file(const char *filename, void (*conf_keyvalue)(void *data, const ch
|
|||||||
regex_t preg;
|
regex_t preg;
|
||||||
if (regcomp(&preg, str_regex, REG_EXTENDED | REG_NOTEOL) != 0) {
|
if (regcomp(&preg, str_regex, REG_EXTENDED | REG_NOTEOL) != 0) {
|
||||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Regular expression used for configuration file parsing is not valid.");
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Regular expression used for configuration file parsing is not valid.");
|
||||||
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
size_t nmatch = preg.re_nsub + 1;
|
size_t nmatch = preg.re_nsub + 1;
|
||||||
@@ -75,6 +76,7 @@ conf_parse_file(const char *filename, void (*conf_keyvalue)(void *data, const ch
|
|||||||
if (!pmatch) {
|
if (!pmatch) {
|
||||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Not enough memory: malloc failed.");
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Not enough memory: malloc failed.");
|
||||||
regfree(&preg);
|
regfree(&preg);
|
||||||
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +110,7 @@ conf_parse_file(const char *filename, void (*conf_keyvalue)(void *data, const ch
|
|||||||
|
|
||||||
free(pmatch);
|
free(pmatch);
|
||||||
regfree(&preg);
|
regfree(&preg);
|
||||||
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user