summaryrefslogtreecommitdiff
path: root/src/sm_manager.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_manager.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_manager.c')
-rw-r--r--src/sm_manager.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/sm_manager.c b/src/sm_manager.c
index 14b2bea..9e0d187 100644
--- a/src/sm_manager.c
+++ b/src/sm_manager.c
@@ -72,8 +72,7 @@ _SmsProtocolSetupProc (IceConn iceConn,
{
const char *str = "Memory allocation failed";
- if ((*failureReasonRet = (char *) malloc (strlen (str) + 1)) != NULL)
- strcpy (*failureReasonRet, str);
+ *failureReasonRet = strdup (str);
return (0);
}
@@ -187,13 +186,11 @@ SmsRegisterClientReply(SmsConn smsConn, char *clientId)
smRegisterClientReplyMsg *pMsg;
char *pData;
- if ((smsConn->client_id = (char *) malloc (strlen (clientId) + 1)) == NULL)
+ if ((smsConn->client_id = strdup (clientId)) == NULL)
{
return (0);
}
- strcpy (smsConn->client_id, clientId);
-
extra = ARRAY8_BYTES (strlen (clientId));
IceGetHeaderExtra (iceConn, _SmsOpcode, SM_RegisterClientReply,