[Midnightbsd-cvs] src [8716] trunk/usr.sbin/pw/pwupd.c: use strdup

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 25 18:23:26 EDT 2016


Revision: 8716
          http://svnweb.midnightbsd.org/src/?rev=8716
Author:   laffer1
Date:     2016-09-25 18:23:26 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
use strdup

Modified Paths:
--------------
    trunk/usr.sbin/pw/pwupd.c

Modified: trunk/usr.sbin/pw/pwupd.c
===================================================================
--- trunk/usr.sbin/pw/pwupd.c	2016-09-25 22:23:06 UTC (rev 8715)
+++ trunk/usr.sbin/pw/pwupd.c	2016-09-25 22:23:26 UTC (rev 8716)
@@ -53,12 +53,10 @@
 {
 	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;
 }
 



More information about the Midnightbsd-cvs mailing list