summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-08-27 07:19:02 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-08-27 06:08:42 -0700
commit899bebbb01220178d94dc3a669bd1ebbff800c25 (patch)
tree4a71da4c6eacf74b96816a0ff18148dc9b0b4d08 /xlators/mgmt
parent8071909e84b6a479a6b5be1eddd15e8b16fc1a80 (diff)
mgmt/glusterd: allocate hostname before dict_set_str for transport
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index f278531650f..31af726509c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -1767,6 +1767,7 @@ glusterd_friend_add (const char *hoststr, int port,
dict_t *options = NULL;
struct rpc_clnt_config rpc_cfg = {0,};
glusterd_peer_hostname_t *name = NULL;
+ char *hostname = NULL;
priv = THIS->private;
@@ -1802,7 +1803,13 @@ glusterd_friend_add (const char *hoststr, int port,
if (!options)
return -1;
- ret = dict_set_str (options, "remote-host", (char *)hoststr);
+ hostname = gf_strdup((char*)hoststr);
+ if (!hostname) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = dict_set_str (options, "remote-host", hostname);
if (ret)
goto out;