summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2017-09-12 14:53:41 +0200
committerShyamsundar Ranganathan <srangana@redhat.com>2017-09-17 12:57:49 +0000
commitd31c45e659d0fd0b740ecfb98b3b92dc8dcca039 (patch)
treea6e42e3f2eac28414b3b52c70f1732a91c7a2c2d /xlators
parentb221e51609f558d96652679943326e940d52e2db (diff)
glusterd: fix invalid memory reference returned
> BUG: 1490897 > 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> Change-Id: I0823c7b33060b48040c1d86ad346a5f6e15bc190 BUG: 1491166 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: https://review.gluster.org/18281 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c11
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 c59719a814a..7f635dcd3de 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)