summaryrefslogtreecommitdiff
path: root/sal/osl/unx
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2014-05-09 10:38:04 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-20 09:47:54 +0200
commitcd11bc699ac50af4f560ed5f2e5e7903de0898b8 (patch)
tree2b5683460af2b171212bb766deb4cb7ee5858d4e /sal/osl/unx
parent498c314861f0913a5b31ee29efc38aad12c3a781 (diff)
C string usage improvment
Change-Id: I5c59f0d2d1b911ffa1ee251e0f1355d137616493 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal/osl/unx')
-rw-r--r--sal/osl/unx/socket.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index e5b1d24b4a07..052ace914c1b 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -790,12 +790,10 @@ static oslHostAddr _osl_hostentToHostAddr (const struct hostent *he)
if (_osl_isFullQualifiedDomainName(he->h_name))
{
- cn= (sal_Char *)malloc(strlen (he->h_name) + 1);
+ cn= (sal_Char *)strdup(he->h_name);
OSL_ASSERT(cn);
if (cn == NULL)
return ((oslHostAddr)NULL);
-
- strcpy(cn, he->h_name);
}
else
{
@@ -889,13 +887,11 @@ oslHostAddr SAL_CALL osl_psz_createHostAddr (
if ((pszHostname == NULL) || (pAddr == NULL))
return ((oslHostAddr)NULL);
- cn = (sal_Char *)malloc(strlen (pszHostname) + 1);
+ cn = (sal_Char *) strdup(pszHostname);
OSL_ASSERT(cn);
if (cn == NULL)
return ((oslHostAddr)NULL);
- strcpy (cn, pszHostname);
-
pHostAddr= (oslHostAddr) malloc(sizeof(struct oslHostAddrImpl));
OSL_ASSERT(pHostAddr);
if (pHostAddr == NULL)