diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2010-08-27 07:19:02 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-08-27 06:08:42 -0700 |
commit | 899bebbb01220178d94dc3a669bd1ebbff800c25 (patch) | |
tree | 4a71da4c6eacf74b96816a0ff18148dc9b0b4d08 /xlators | |
parent | 8071909e84b6a479a6b5be1eddd15e8b16fc1a80 (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')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 9 |
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; |