diff options
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); } |