diff options
author | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2021-06-25 10:04:01 +0100 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-07-10 21:38:02 +0000 |
commit | aa0f0f65e7a88fd63766b6e4098417c24b5303a8 (patch) | |
tree | 858a29d5205a1404f83235ed15729463d5925e7f | |
parent | bc38bea800032eaa11588189d41f618386633696 (diff) |
Snort config: Avoid leaks when fail to open config file.
CID: 1477713
CID: 1477850
(cherry picked from commit bbcd42be8763b5b91b4f3bca51b169cec5487ff5)
-rw-r--r-- | epan/dissectors/packet-snort-config.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/epan/dissectors/packet-snort-config.c b/epan/dissectors/packet-snort-config.c index 1bf3f42d9a..0372fb5333 100644 --- a/epan/dissectors/packet-snort-config.c +++ b/epan/dissectors/packet-snort-config.c @@ -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); } |