Author: truckman
Date: Wed May 25 02:51:15 2016
New Revision: 300643
URL: https://svnweb.freebsd.org/changeset/base/300643

Log:
  Close from_fd if malloc() fails to avoid a file descriptor leak.
  
  Reported by:  Coverity
  CID:          1007203
  MFC after:    1 week

Modified:
  head/bin/mv/mv.c

Modified: head/bin/mv/mv.c
==============================================================================
--- head/bin/mv/mv.c    Wed May 25 02:10:30 2016        (r300642)
+++ head/bin/mv/mv.c    Wed May 25 02:51:15 2016        (r300643)
@@ -286,6 +286,7 @@ fastcopy(const char *from, const char *t
        }
        if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) {
                warnx("malloc(%u) failed", blen);
+               (void)close(from_fd);
                return (1);
        }
        while ((to_fd =
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to