From 46f3ef4460aa2c1c2cba22897694a1cea572d506 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 19 Nov 2011 10:23:24 -0800 Subject: Replace malloc(strlen) + strcpy sets with strdup calls Signed-off-by: Alan Coopersmith Reviewed-by: Mark Kettenis Reviewed-by: James Cloos --- src/sm_genid.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/sm_genid.c') diff --git a/src/sm_genid.c b/src/sm_genid.c index ffeab7e..0a09276 100644 --- a/src/sm_genid.c +++ b/src/sm_genid.c @@ -139,8 +139,7 @@ SmsGenerateClientID(SmsConn smsConn) temp[1] = '\0'; uuid_unparse_lower(uuid, &temp[1]); - if ((id = malloc (strlen (temp) + 1)) != NULL) - strcpy (id, temp); + id = strdup (temp); return id; #else @@ -243,8 +242,7 @@ SmsGenerateClientID(SmsConn smsConn) if (++sequence > 9999) sequence = 0; - if ((id = malloc (strlen (temp) + 1)) != NULL) - strcpy (id, temp); + id = strdup (temp); return (id); # else -- cgit v1.2.3