From 42c98f4f1180e8cf91068a70646ca94a70400f2a Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 27 Mar 2014 00:50:32 +0000 Subject: Review Comments Change-Id: Ifce90b0b617bc0b43a9af0bd692a7290820ac62c Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/7358 Reviewed-by: Rajesh Joseph Tested-by: Rajesh Joseph --- xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c | 29 ++++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c index a2546ca94..a5f38ce9c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c @@ -100,8 +100,6 @@ glusterd_op_state_machine_mgmt_v3_lock (rpcsvc_request_t *req, if (ret) { gf_log (this->name, GF_LOG_ERROR, "Unable to set transaction's opinfo"); - if (ctx->dict) - dict_unref (ctx->dict); goto out; } @@ -188,11 +186,13 @@ out: if (ret) { if (ctx->dict) - dict_destroy (ctx->dict); + dict_unref (ctx->dict); if (ctx) GF_FREE (ctx); } + free (lock_req.dict.dict_val); + gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret); return ret; } @@ -254,7 +254,8 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req) ret = xdr_to_generic (req->msg[0], &op_req, (xdrproc_t)xdr_gd1_mgmt_v3_pre_val_req); if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, "Failed to decode pre validation " + gf_log (this->name, GF_LOG_ERROR, + "Failed to decode pre validation " "request received from peer"); req->rpc_err = GARBAGE_ARGS; goto out; @@ -294,7 +295,6 @@ glusterd_handle_pre_validate_fn (rpcsvc_request_t *req) gf_log (this->name, GF_LOG_ERROR, "Pre Validation failed on operation %s", gd_op_list[op_req.op]); - goto out; } ret = glusterd_mgmt_v3_pre_validate_send_resp (req, op_req.op, @@ -314,6 +314,9 @@ out: free (op_req.dict.dict_val); + if (dict) + dict_unref (dict); + if (rsp_dict) dict_unref (rsp_dict); @@ -418,7 +421,6 @@ glusterd_handle_brick_op_fn (rpcsvc_request_t *req) gf_log (this->name, GF_LOG_ERROR, "Brick Op failed on operation %s", gd_op_list[op_req.op]); - goto out; } ret = glusterd_mgmt_v3_brick_op_send_resp (req, op_req.op, @@ -438,6 +440,9 @@ out: free (op_req.dict.dict_val); + if (dict) + dict_unref (dict); + if (rsp_dict) dict_unref (rsp_dict); @@ -541,7 +546,6 @@ glusterd_handle_commit_fn (rpcsvc_request_t *req) gf_log (this->name, GF_LOG_ERROR, "commit failed on operation %s", gd_op_list[op_req.op]); - goto out; } ret = glusterd_mgmt_v3_commit_send_resp (req, op_req.op, @@ -561,6 +565,9 @@ out: free (op_req.dict.dict_val); + if (dict) + dict_unref (dict); + if (rsp_dict) dict_unref (rsp_dict); @@ -666,7 +673,6 @@ glusterd_handle_post_validate_fn (rpcsvc_request_t *req) gf_log (this->name, GF_LOG_ERROR, "Post Validation failed on operation %s", gd_op_list[op_req.op]); - goto out; } ret = glusterd_mgmt_v3_post_validate_send_resp (req, op_req.op, @@ -686,6 +692,9 @@ out: free (op_req.dict.dict_val); + if (dict) + dict_unref (dict); + if (rsp_dict) dict_unref (rsp_dict); @@ -842,11 +851,13 @@ out: if (ret) { if (ctx->dict) - dict_destroy (ctx->dict); + dict_unref (ctx->dict); if (ctx) GF_FREE (ctx); } + free (lock_req.dict.dict_val); + gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret); return ret; } -- cgit