svn commit: r300643 - head/bin/mv

Don Lewis truckman at FreeBSD.org
Wed May 25 02:51:16 UTC 2016


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 =


More information about the svn-src-all mailing list