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_genid.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_genid.c')
-rw-r--r-- | src/sm_genid.c | 6 |
1 files changed, 2 insertions, 4 deletions
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 |