pw: Fix a resource leak.
Reported by: Coverity MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc.
This commit is contained in:
parent
45bfd3158c
commit
7a82cf511d
@ -57,6 +57,10 @@ rm_r(int rootfd, const char *path, uid_t uid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
d = fdopendir(dirfd);
|
d = fdopendir(dirfd);
|
||||||
|
if (d == NULL) {
|
||||||
|
(void)close(dirfd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
while ((e = readdir(d)) != NULL) {
|
while ((e = readdir(d)) != NULL) {
|
||||||
if (strcmp(e->d_name, ".") == 0 || strcmp(e->d_name, "..") == 0)
|
if (strcmp(e->d_name, ".") == 0 || strcmp(e->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user