From: Victor Julien Date: Tue, 23 Oct 2018 11:53:13 +0000 (+0200) Subject: yaml: fix potential memleak and suppress coverity issue X-Git-Tag: suricata-4.1.0~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d54a8361d07213b6201f3466e790b1aa4be07d7;p=thirdparty%2Fsuricata.git yaml: fix potential memleak and suppress coverity issue --- diff --git a/src/conf-yaml-loader.c b/src/conf-yaml-loader.c index e6a4be30b0..7599c1f1db 100644 --- a/src/conf-yaml-loader.c +++ b/src/conf-yaml-loader.c @@ -418,10 +418,12 @@ ConfYamlLoadFile(const char *filename) if (stat_buf.st_mode & S_IFDIR) { SCLogError(SC_ERR_FATAL, "yaml argument is not a file but a directory: %s. " "Please specify the yaml file in your -c option.", filename); + yaml_parser_delete(&parser); return -1; } } + // coverity[toctou : FALSE] infile = fopen(filename, "r"); if (infile == NULL) { SCLogError(SC_ERR_FATAL, "failed to open file: %s: %s", filename,