summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-04-13 17:29:41 +0530
committerAnand Avati <avati@redhat.com>2012-04-23 14:52:57 -0700
commit29f2de478cc6a475e6ae760d9cbe7ac847e9d79c (patch)
tree621fbb33e6e3de20f7c1b59a98e181c7b50b4796 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
parent4c9e8fad23836d87b0c4327e990c789630fe5b97 (diff)
core: coverity issues fixed
this is not a complete set of issues getting fixed. Will address other issues in another patch. Change-Id: Ib01c7b11b205078cc4d0b3f11610751e32d14b69 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 789278 Reviewed-on: http://review.gluster.com/3145 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index ddc4d1f492d..a7ccda71f72 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -837,7 +837,9 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
- rsp.op_errstr = "error";
+ /* use standard allocation because to keep uniformity
+ in freeing it */
+ rsp.op_errstr = strdup ("error");
goto out;
}
@@ -846,7 +848,9 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov,
gf_log ("", GF_LOG_ERROR, "error");
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
- rsp.op_errstr = "error";
+ /* use standard allocation because to keep uniformity
+ in freeing it */
+ rsp.op_errstr = strdup ("xdr decoding failed");
goto out;
}
@@ -918,7 +922,7 @@ out:
glusterd_op_sm ();
}
- if (rsp.op_errstr && strcmp (rsp.op_errstr, "error"))
+ if (rsp.op_errstr)
free (rsp.op_errstr); //malloced by xdr
if (dict) {
if (!dict->extra_stdfree && rsp.dict.dict_val)
@@ -1268,17 +1272,21 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov,
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
- rsp.op_errstr = "error";
+ /* use standard allocation because to keep uniformity
+ in freeing it */
+ rsp.op_errstr = strdup ("error");
event_type = GD_OP_EVENT_RCVD_RJT;
goto out;
}
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gd1_mgmt_commit_op_rsp);
if (ret < 0) {
- gf_log ("", GF_LOG_ERROR, "error");
+ gf_log ("", GF_LOG_ERROR, "xdr decoding error");
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
- rsp.op_errstr = "error";
+ /* use standard allocation because to keep uniformity
+ in freeing it */
+ rsp.op_errstr = strdup ("xdr decoding error");
event_type = GD_OP_EVENT_RCVD_RJT;
goto out;
}
@@ -1395,7 +1403,7 @@ out:
if (dict)
dict_unref (dict);
- if (rsp.op_errstr && strcmp (rsp.op_errstr, "error"))
+ if (rsp.op_errstr)
free (rsp.op_errstr); //malloced by xdr
GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe));
return ret;
@@ -1788,7 +1796,9 @@ glusterd3_1_brick_op_cbk (struct rpc_req *req, struct iovec *iov,
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = EINVAL;
- rsp.op_errstr = "error";
+ /* use standard allocation because to keep uniformity
+ in freeing it */
+ rsp.op_errstr = strdup ("error");
event_type = GD_OP_EVENT_RCVD_RJT;
goto out;
}
@@ -1857,7 +1867,7 @@ out:
if (ret && dict)
dict_unref (dict);
- if (rsp.op_errstr && strcmp (rsp.op_errstr, "error"))
+ if (rsp.op_errstr)
free (rsp.op_errstr); //malloced by xdr
GLUSTERD_STACK_DESTROY (frame);
return ret;