Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Oct 2015 18:29:29 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r290153 - head/usr.sbin/pw
Message-ID:  <201510291829.t9TITTob093109@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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';
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510291829.t9TITTob093109>