diff options
| author | Pranith Kumar K <pranithk@gluster.com> | 2010-09-15 08:35:42 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-15 07:28:28 -0700 | 
| commit | e7535ad313d08ec587311729f049397d3ed995ce (patch) | |
| tree | 1b198ccf334b6c0eb1f71c1bd0ba910beb36b277 /xlators/mgmt/glusterd/src/glusterd3_1-mops.c | |
| parent | 1c92eefd50f6ade459b293da6aa5e44b0cd72271 (diff) | |
mgmt/glusterd: gf_strdup the rsp msg and free xdr memoryv3.1.0qa23
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1613 (glusterd crash in create volume failure)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1613
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd3_1-mops.c')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd3_1-mops.c | 18 | 
1 files changed, 16 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c index 9435099906c..6adec5dfe62 100644 --- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c +++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c @@ -530,7 +530,12 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov,          if (op_ret) {                  event_type = GD_OP_EVENT_RCVD_RJT;                  opinfo.op_ret = op_ret; -                opinfo.op_errstr = rsp.op_errstr;  +                opinfo.op_errstr = gf_strdup(rsp.op_errstr); +                if (!opinfo.op_errstr) { +                        gf_log ("", GF_LOG_ERROR, "memory allocation failed"); +                        ret = -1; +                        goto out; +                }          } else {                  event_type = GD_OP_EVENT_RCVD_ACC;          } @@ -543,6 +548,8 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov,          }  out: +        if (rsp.op_errstr && strcmp (rsp.op_errstr, "")) +                free (rsp.op_errstr); //malloced by xdr          return ret;  } @@ -650,7 +657,12 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov,          if (op_ret) {                  event_type = GD_OP_EVENT_RCVD_RJT;                  opinfo.op_ret = op_ret; -                opinfo.op_errstr = rsp.op_errstr; +                opinfo.op_errstr = gf_strdup(rsp.op_errstr); +                if (!opinfo.op_errstr) { +                        gf_log ("", GF_LOG_ERROR, "memory allocation failed"); +                        ret = -1; +                        goto out; +                }          } else {                  if (rsp.op == GD_OP_REPLACE_BRICK) {                          ret = glusterd_rb_use_rsp_dict (dict); @@ -673,6 +685,8 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov,  out:          if (dict)                  dict_unref (dict); +        if (rsp.op_errstr && strcmp (rsp.op_errstr, "")) +                free (rsp.op_errstr); //malloced by xdr          return ret;  }  | 
