diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-19 10:23:24 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-09 17:37:09 -0800 |
commit | 46f3ef4460aa2c1c2cba22897694a1cea572d506 (patch) | |
tree | 8946f6fc1c623d40783992dfe2ae9383e1bcc707 /src/sm_misc.c | |
parent | fb3ef5844d392f70cc6bd9b0d8770ca17bde1428 (diff) |
Replace malloc(strlen) + strcpy sets with strdup calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
Diffstat (limited to 'src/sm_misc.c')
-rw-r--r-- | src/sm_misc.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/sm_misc.c b/src/sm_misc.c index bdef3dd..c081611 100644 --- a/src/sm_misc.c +++ b/src/sm_misc.c @@ -104,33 +104,21 @@ SmcProtocolRevision(SmcConn smcConn) char * SmcVendor(SmcConn smcConn) { - char *string = (char *) malloc (strlen (smcConn->vendor) + 1); - - strcpy (string, smcConn->vendor); - - return (string); + return strdup(smcConn->vendor); } char * SmcRelease(SmcConn smcConn) { - char *string = (char *) malloc (strlen (smcConn->release) + 1); - - strcpy (string, smcConn->release); - - return (string); + return strdup(smcConn->release); } char * SmcClientID(SmcConn smcConn) { - char *clientId = (char *) malloc (strlen (smcConn->client_id) + 1); - - strcpy (clientId, smcConn->client_id); - - return (clientId); + return strdup(smcConn->client_id); } @@ -163,11 +151,7 @@ SmsProtocolRevision(SmsConn smsConn) char * SmsClientID(SmsConn smsConn) { - char *clientId = (char *) malloc (strlen (smsConn->client_id) + 1); - - strcpy (clientId, smsConn->client_id); - - return (clientId); + return strdup(smsConn->client_id); } |