Snort config: Avoid leaks when fail to open config file.

CID: 1477713
CID: 1477850


(cherry picked from commit bbcd42be87)
This commit is contained in:
Martin Mathieson 2021-06-25 10:04:01 +01:00 committed by Wireshark GitLab Utility
parent bc38bea800
commit aa0f0f65e7
1 changed files with 5 additions and 6 deletions

View File

@ -928,16 +928,15 @@ void create_config(SnortConfig_t **snort_config, const char *snort_config_file)
if (config_file_fd == NULL) {
snort_debug_printf("Failed to open config file %s\n", snort_config_file);
report_failure("Snort dissector: Failed to open config file %s\n", snort_config_file);
return;
}
/* Start parsing from the top-level config file. */
parse_config_file(*snort_config, config_file_fd, snort_config_file, dirname, 1 /* recursion level */);
else {
/* Start parsing from the top-level config file. */
parse_config_file(*snort_config, config_file_fd, snort_config_file, dirname, 1 /* recursion level */);
fclose(config_file_fd);
}
g_free(dirname);
g_free(basename);
fclose(config_file_fd);
}