diff options
author | Jim Meyering <meyering@redhat.com> | 2012-07-13 10:29:48 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-07-13 14:03:42 -0700 |
commit | 7820b2c1f88b207a8b1270b8c3cb3b797b7563d2 (patch) | |
tree | 5a383d85eb18399cf7506a90cc7627c749ccf9b8 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | |
parent | 2dc0d32e5d8b205fa407073b209bb663d546dde8 (diff) |
remove useless if-before-free (and free-like) functions
See comments in http://bugzilla.redhat.com/839925 for
the code to perform this change.
Signed-off-by: Jim Meyering <meyering@redhat.com>
BUG: 839925
Change-Id: I10e4ecff16c3749fe17c2831c516737e08a3205a
Reviewed-on: http://review.gluster.com/3661
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index f5863117e45..7937235beba 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -185,8 +185,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret, ret = glusterd_submit_reply (req, cli_rsp, NULL, 0, NULL, xdrproc); - if (free_ptr) - GF_FREE (free_ptr); + GF_FREE (free_ptr); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -288,8 +287,7 @@ glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("glusterd", GF_LOG_INFO, "Received resp to probe req"); out: - if (rsp.hostname) - free (rsp.hostname);//malloced by xdr + free (rsp.hostname);//malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -382,8 +380,7 @@ out: } if (ctx) glusterd_destroy_probe_ctx (ctx); - if (rsp.hostname) - free (rsp.hostname);//malloced by xdr + free (rsp.hostname);//malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -477,8 +474,7 @@ respond: glusterd_destroy_probe_ctx (ctx); } - if (rsp.hostname) - free (rsp.hostname);//malloced by xdr + free (rsp.hostname);//malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -925,15 +921,13 @@ out: glusterd_op_sm (); } - if (rsp.op_errstr) - free (rsp.op_errstr); //malloced by xdr + free (rsp.op_errstr); //malloced by xdr if (dict) { if (!dict->extra_stdfree && rsp.dict.dict_val) free (rsp.dict.dict_val); //malloced by xdr dict_unref (dict); } else { - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); //malloced by xdr + free (rsp.dict.dict_val); //malloced by xdr } GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; @@ -1422,8 +1416,7 @@ out: if (dict) dict_unref (dict); - if (rsp.op_errstr) - free (rsp.op_errstr); //malloced by xdr + free (rsp.op_errstr); //malloced by xdr GLUSTERD_STACK_DESTROY (((call_frame_t *)myframe)); return ret; } @@ -1472,8 +1465,7 @@ glusterd_rpc_probe (call_frame_t *frame, xlator_t *this, (xdrproc_t)xdr_gd1_mgmt_probe_req); out: - if (req.hostname) - GF_FREE (req.hostname); + GF_FREE (req.hostname); gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; } @@ -1523,8 +1515,7 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this, out: - if (req.vols.vols_val) - GF_FREE (req.vols.vols_val); + GF_FREE (req.vols.vols_val); if (vols) dict_unref (vols); @@ -1606,8 +1597,7 @@ glusterd_rpc_friend_update (call_frame_t *frame, xlator_t *this, (xdrproc_t)xdr_gd1_mgmt_friend_update); out: - if (req.friends.friends_val) - GF_FREE (req.friends.friends_val); + GF_FREE (req.friends.friends_val); gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1882,8 +1872,7 @@ out: if (ret && dict) dict_unref (dict); - if (rsp.op_errstr) - free (rsp.op_errstr); //malloced by xdr + free (rsp.op_errstr); //malloced by xdr GLUSTERD_STACK_DESTROY (frame); return ret; } @@ -1951,8 +1940,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, opinfo.brick_pending_count = 0; ret = 0; if (req) { - if (req->input.input_val) - GF_FREE (req->input.input_val); + GF_FREE (req->input.input_val); GF_FREE (req); req = NULL; } @@ -1979,8 +1967,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, this, glusterd_brick_op_cbk, (xdrproc_t)xdr_gd1_mgmt_brick_op_req); if (req) { - if (req->input.input_val) - GF_FREE (req->input.input_val); + GF_FREE (req->input.input_val); GF_FREE (req); req = NULL; } |