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';
 
        /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to