mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
ls: Release resources before returning from traverse()
PR: 278476 MFC after: 2 weeks Reported by: valgrind
This commit is contained in:
parent
ae4f708f0b
commit
e6c9c46338
1 changed files with 4 additions and 1 deletions
|
|
@ -643,8 +643,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
|
||||
|
|
@ -693,6 +695,7 @@ traverse(int argc, char *argv[], int options)
|
|||
}
|
||||
if (errno)
|
||||
err(1, "fts_read");
|
||||
fts_close(ftsp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue