umask_open: don't leak fd on success

MFC after:	3 days
Reported by:	Coverity
CID:		978315
This commit is contained in:
Enji Cooper 2017-01-04 03:41:16 +00:00
parent 358e989f83
commit ab25ecadbf

View File

@ -129,6 +129,9 @@ ATF_TC_BODY(umask_open, tc)
if (fd < 0)
continue;
#ifdef __FreeBSD__
(void)close(fd);
#endif
(void)memset(&st, 0, sizeof(struct stat));
if (stat(path, &st) != 0) {