Author: markj
Date: Tue Sep 1 15:14:51 2020
New Revision: 365045
URL: https://svnweb.freebsd.org/changeset/base/365045
Log:
pw: Fix a resource leak.
Reported by: Coverity
MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Modified:
head/usr.sbin/pw/rm_r.c
Modified: head/usr.sbin/pw/rm_r.c
==============================================================================
--- head/usr.sbin/pw/rm_r.c Tue Sep 1 15:14:26 2020 (r365044)
+++ head/usr.sbin/pw/rm_r.c Tue Sep 1 15:14:51 2020 (r365045)
@@ -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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"