Merge remote-tracking branch 'origin/topic/neverlord/coverity-1523915'

* origin/topic/neverlord/coverity-1523915:
  Bind scan_path to the scope; avoid heap allocation
This commit is contained in:
Arne Welzel 2023-11-11 17:45:51 +01:00
commit abc32b3b46
3 changed files with 6 additions and 6 deletions

View file

@ -1,3 +1,7 @@
6.2.0-dev.137 | 2023-11-11 17:45:51 +0100
* Bind scan_path to the scope; avoid heap allocation (Dominik Charousset, Corelight)
6.2.0-dev.134 | 2023-11-10 12:42:57 +0100
* retention of superseded AST elements to prevent pointer mis-aliasing (Vern Paxson, Corelight)

View file

@ -1 +1 @@
6.2.0-dev.134
6.2.0-dev.137

View file

@ -439,15 +439,12 @@ vector<string> dir_contents_recursive(string dir) {
while ( dir[dir.size() - 1] == '/' )
dir.erase(dir.size() - 1, 1);
char** scan_path = new char*[2];
scan_path[0] = dir.data();
scan_path[1] = NULL;
char* scan_path[2] = {dir.data(), nullptr};
FTS* fts = fts_open(scan_path, FTS_NOCHDIR, 0);
if ( ! fts ) {
reporter->Error("fts_open failure: %s", strerror(errno));
delete[] scan_path;
return rval;
}
@ -464,7 +461,6 @@ vector<string> dir_contents_recursive(string dir) {
if ( fts_close(fts) < 0 )
reporter->Error("fts_close failure: %s", strerror(errno));
delete[] scan_path;
return rval;
}