summaryrefslogtreecommitdiff
path: root/src/sm_misc.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-19 10:23:24 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-12-09 17:37:09 -0800
commit46f3ef4460aa2c1c2cba22897694a1cea572d506 (patch)
tree8946f6fc1c623d40783992dfe2ae9383e1bcc707 /src/sm_misc.c
parentfb3ef5844d392f70cc6bd9b0d8770ca17bde1428 (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.c24
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);
}