diff options
author | truckman <truckman@FreeBSD.org> | 2016-06-01 17:30:50 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-06-01 17:30:50 +0000 |
commit | ed265b2890fdcb1fa5b9bbdaddfd54fb5e3cf2ed (patch) | |
tree | 2ee95fce85b917d408ad9f25e69d2670f9ae9911 | |
parent | 10d7f27879527fd48fe5906f0141d54d5b2c69aa (diff) | |
download | FreeBSD-src-ed265b2890fdcb1fa5b9bbdaddfd54fb5e3cf2ed.zip FreeBSD-src-ed265b2890fdcb1fa5b9bbdaddfd54fb5e3cf2ed.tar.gz |
MFC r300643
Close from_fd if malloc() fails to avoid a file descriptor leak.
Reported by: Coverity
CID: 1007203
-rw-r--r-- | bin/mv/mv.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c index a23b6da..ea629d2 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -285,6 +285,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 = |