diff options
author | Mark Johnston <markj@FreeBSD.org> | 2020-09-01 15:14:51 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2020-09-01 15:14:51 +0000 |
commit | 0352161ff390269df8d9a0bf9df8bf76de7e879e (patch) | |
tree | 95bd8fce5f8e0de7a919bd2053628dc07be67d6f | |
parent | 8e1831db8e1354c3343f548e9df5db1f48d1f94c (diff) | |
download | pw-darwin-0352161ff390269df8d9a0bf9df8bf76de7e879e.tar.gz pw-darwin-0352161ff390269df8d9a0bf9df8bf76de7e879e.tar.zst pw-darwin-0352161ff390269df8d9a0bf9df8bf76de7e879e.zip |
pw: Fix a resource leak.
Reported by: Coverity
MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
-rw-r--r-- | pw/rm_r.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -57,6 +57,10 @@ rm_r(int rootfd, const char *path, uid_t uid) } d = fdopendir(dirfd); + if (d == NULL) { + (void)close(dirfd); + return; + } while ((e = readdir(d)) != NULL) { if (strcmp(e->d_name, ".") == 0 || strcmp(e->d_name, "..") == 0) continue; |