mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
Close from_fd if malloc() fails to avoid a file descriptor leak.
Reported by: Coverity CID: 1007203 MFC after: 1 week
This commit is contained in:
parent
ae100660d4
commit
8dd8cd00e2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300643
@ -286,6 +286,7 @@ fastcopy(const char *from, const char *to, struct stat *sbp)
|
||||
}
|
||||
if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) {
|
||||
warnx("malloc(%u) failed", blen);
|
||||
(void)close(from_fd);
|
||||
return (1);
|
||||
}
|
||||
while ((to_fd =
|
||||
|
Loading…
Reference in New Issue
Block a user