diff options
author | truckman <truckman@FreeBSD.org> | 2016-05-25 02:51:15 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-05-25 02:51:15 +0000 |
commit | 36fa61883428b677cc1cbf35c851cf4dbbf4990b (patch) | |
tree | db703ac0460c38c44d91419fbcdded3bbd3cad5b /bin/mv | |
parent | 7fa8459fdb5367b97611bd13ebda4810a9261f4e (diff) | |
download | FreeBSD-src-36fa61883428b677cc1cbf35c851cf4dbbf4990b.zip FreeBSD-src-36fa61883428b677cc1cbf35c851cf4dbbf4990b.tar.gz |
Close from_fd if malloc() fails to avoid a file descriptor leak.
Reported by: Coverity
CID: 1007203
MFC after: 1 week
Diffstat (limited to 'bin/mv')
-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 c19f6a0..9a300e6 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -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 = |