mirror of
https://github.com/opnsense/src.git
synced 2026-02-18 18:20:26 -05:00
ls: Release resources before returning from traverse()
PR: 278476 MFC after: 2 weeks Reported by: valgrind (cherry picked from commit e6c9c463384d11a44af3e5f2cc947fb69f3a1968)
This commit is contained in:
parent
be53f73266
commit
66ff03065d
1 changed files with 4 additions and 1 deletions
|
|
@ -655,8 +655,10 @@ traverse(int argc, char *argv[], int options)
|
|||
chp = fts_children(ftsp, 0);
|
||||
if (chp != NULL)
|
||||
display(NULL, chp, options);
|
||||
if (f_listdir)
|
||||
if (f_listdir) {
|
||||
fts_close(ftsp);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If not recursing down this tree and don't need stat info, just get
|
||||
|
|
@ -705,6 +707,7 @@ traverse(int argc, char *argv[], int options)
|
|||
}
|
||||
if (errno)
|
||||
err(1, "fts_read");
|
||||
fts_close(ftsp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue