diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2017-09-12 14:53:41 +0200 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-09-13 20:02:33 +0000 |
commit | 2ec0dfe76780a8f82f4f6f8b7b3fdfd54203b616 (patch) | |
tree | 096b2f5a3d4c6bd509804280de8c438af20ee143 /xlators | |
parent | 0643510e9852059b465e99f4ea255a3d3aeb9e86 (diff) |
glusterd: fix invalid memory reference returned
Change-Id: I0823c7b33060b48040c1d86ad346a5f6e15bc190
BUG: 1490897
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: https://review.gluster.org/18263
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Reviewed-by: Gaurav Yadav <gyadav@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handshake.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c index 214dc6abd98..c7e419c5691 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -441,6 +441,7 @@ glusterd_get_args_from_dict (gf_getspec_req *args, peer_info_t *peerinfo, int client_min_op_version = 1; int32_t ret = -1; xlator_t *this = NULL; + char *name = NULL; this = THIS; GF_ASSERT (this); @@ -485,14 +486,18 @@ glusterd_get_args_from_dict (gf_getspec_req *args, peer_info_t *peerinfo, goto out; } - ret = dict_get_str (dict, "brick_name", - brick_name); + ret = dict_get_str (dict, "brick_name", &name); if (ret) { gf_msg_debug (this->name, 0, "No brick name present"); ret = 0; goto out; } + *brick_name = gf_strdup(name); + if (*brick_name == NULL) { + ret = -1; + goto out; + } gf_msg_debug (this->name, 0, "brick_name = %s", *brick_name); out: @@ -943,6 +948,8 @@ fail: if (spec_fd > 0) sys_close (spec_fd); + GF_FREE(brick_name); + rsp.op_ret = ret; if (op_errno) |