Author: eadler
Date: Sun Feb  3 03:43:59 2013
New Revision: 246280
URL: http://svnweb.freebsd.org/changeset/base/246280

Log:
  MFC r243896:
        Use strdup instead of malloc + strcpy
  
  Approved by:  cperciva (mentor, implicit)

Modified:
  stable/9/usr.sbin/pw/pwupd.c
Directory Properties:
  stable/9/usr.sbin/pw/   (props changed)

Modified: stable/9/usr.sbin/pw/pwupd.c
==============================================================================
--- stable/9/usr.sbin/pw/pwupd.c        Sun Feb  3 03:38:44 2013        
(r246279)
+++ stable/9/usr.sbin/pw/pwupd.c        Sun Feb  3 03:43:59 2013        
(r246280)
@@ -53,12 +53,10 @@ setpwdir(const char * dir)
 {
        if (dir == NULL)
                return -1;
-       else {
-               char * d = malloc(strlen(dir)+1);
-               if (d == NULL)
-                       return -1;
-               pwpath = strcpy(d, dir);
-       }
+       else
+               pwpath = strdup(dir);
+       if (pwpath == NULL)
+               return -1;
        return 0;
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to