summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index e7134c990b7..7be5fdb0510 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -53,6 +53,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
gd_serialize_t sfunc = NULL;
void *cli_rsp = NULL;
dict_t *ctx = NULL;
+ char *free_ptr = NULL;
switch (op) {
case GD_OP_CREATE_VOLUME:
@@ -181,10 +182,20 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
rsp.op_ret = op_ret;
rsp.op_errno = op_errno;
rsp.volname = "";
+ ctx = op_ctx;
+
if (op_errstr)
rsp.op_errstr = op_errstr;
else
rsp.op_errstr = "";
+ if (ctx) {
+ ret = dict_allocate_and_serialize (ctx,
+ &rsp.dict.dict_val,
+ (size_t*)&rsp.dict.dict_len);
+ if (ret == 0)
+ free_ptr = rsp.dict.dict_val;
+ }
+
cli_rsp = &rsp;
sfunc = gf_xdr_serialize_cli_set_vol_rsp;
break;
@@ -316,10 +327,9 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
ret = glusterd_submit_reply (req, cli_rsp, NULL, 0, NULL,
sfunc);
- if (ret)
- goto out;
+ if (free_ptr)
+ GF_FREE (free_ptr);
-out:
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}