]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
yaml: fix potential memleak and suppress coverity issue
authorVictor Julien <victor@inliniac.net>
Tue, 23 Oct 2018 11:53:13 +0000 (13:53 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 30 Oct 2018 09:21:34 +0000 (10:21 +0100)
src/conf-yaml-loader.c

index e6a4be30b081eaba33dffe88148fc778c8e71566..7599c1f1dbeb9089ee550405f179e20c406143c7 100644 (file)
@@ -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,