summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-30 20:19:44 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-30 20:19:44 -0700
commit37092d5ae31fa53c9a2f378786bfebe26e04c030 (patch)
treec8b4cac015deaa191f1e4c523af0388b08b118ce
parent283b9a2a9da3ad662789d1127a486c8735589f73 (diff)
Use strdup instead of malloc(strlen+1); strcpy();
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--common.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/common.c b/common.c
index 1baf288..42220cd 100644
--- a/common.c
+++ b/common.c
@@ -262,10 +262,9 @@ SetUpConnectionSocket(
struct hostent *hp;
(void) gethostname(MyHostName, sizeof(MyHostName));
- ScopeHost = malloc((1+strlen(MyHostName)));
+ ScopeHost = strdup(MyHostName);
if (ScopeHost == NULL)
panic("Can't allocate memory for hostname");
- strcpy(ScopeHost, MyHostName);
hp = gethostbyname(MyHostName);
if (hp == NULL)
panic("No address for our host");