svn commit: r290153 - head/usr.sbin/pw

Bryan Drewery bdrewery at FreeBSD.org
Thu Oct 29 18:29:30 UTC 2015


Author: bdrewery
Date: Thu Oct 29 18:29:28 2015
New Revision: 290153
URL: https://svnweb.freebsd.org/changeset/base/290153

Log:
  Fix unlikely memory leak.
  
  It is unlikely since the first check in the function is that dir[0] is '/',
  but later code changes may make it real.
  
  Coverity CID:	1332104

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Thu Oct 29 17:51:48 2015	(r290152)
+++ head/usr.sbin/pw/pw_user.c	Thu Oct 29 18:29:28 2015	(r290153)
@@ -107,8 +107,10 @@ mkdir_home_parents(int dfd, const char *
 		errx(EX_UNAVAILABLE, "out of memory");
 
 	tmp = strrchr(dirs, '/');
-	if (tmp == NULL)
+	if (tmp == NULL) {
+		free(dirs);
 		return;
+	}
 	tmp[0] = '\0';
 
 	/*


More information about the svn-src-head mailing list