Date: Sun, 3 Feb 2013 03:44:00 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246280 - stable/9/usr.sbin/pw Message-ID: <201302030344.r133i0kl017764@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302030344.r133i0kl017764>