svn commit: r293684 - stable/10/usr.sbin/pw

Baptiste Daroussin bapt at FreeBSD.org
Mon Jan 11 19:26:20 UTC 2016


Author: bapt
Date: Mon Jan 11 19:26:18 2016
New Revision: 293684
URL: https://svnweb.freebsd.org/changeset/base/293684

Log:
  MFC: r290153 (by bdrewery)
  
  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:
  stable/10/usr.sbin/pw/pw_user.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pw/pw_user.c
==============================================================================
--- stable/10/usr.sbin/pw/pw_user.c	Mon Jan 11 19:25:43 2016	(r293683)
+++ stable/10/usr.sbin/pw/pw_user.c	Mon Jan 11 19:26:18 2016	(r293684)
@@ -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-all mailing list