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';
 
        /*
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to