Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 2016 19:26:19 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293684 - stable/10/usr.sbin/pw
Message-ID:  <201601111926.u0BJQJLd066764@repo.freebsd.org>

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



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