summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c27
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c72
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-log-ops.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mountbroker.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c18
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c39
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c18
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c54
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c27
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c3
19 files changed, 115 insertions, 231 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index a0e24b434cd..640b8cb0dcc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -552,8 +552,7 @@ out:
glusterd_friend_sm ();
glusterd_op_sm ();
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val); //its malloced by xdr
+ free (cli_req.dict.dict_val); //its malloced by xdr
return ret;
}
@@ -850,10 +849,8 @@ out:
ret = 0; //sent error to cli, prevent second reply
}
- if (brick_list)
- GF_FREE (brick_list);
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val); //its malloced by xdr
+ GF_FREE (brick_list);
+ free (cli_req.dict.dict_val); //its malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -972,10 +969,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count,
}
out:
- if (free_ptr1)
- GF_FREE (free_ptr1);
- if (free_ptr2)
- GF_FREE (free_ptr2);
+ GF_FREE (free_ptr1);
+ GF_FREE (free_ptr2);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
@@ -1033,8 +1028,7 @@ glusterd_op_perform_remove_brick (glusterd_volinfo_t *volinfo, char *brick,
brickinfo->decommissioned = 1;
out:
- if (dup_brick)
- GF_FREE (dup_brick);
+ GF_FREE (dup_brick);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
@@ -1182,14 +1176,11 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr)
}
out:
- if (free_ptr)
- GF_FREE (free_ptr);
+ GF_FREE (free_ptr);
if (brick_alloc && brickinfo)
glusterd_brickinfo_delete (brickinfo);
- if (str_ret)
- GF_FREE (str_ret);
- if (all_bricks)
- GF_FREE (all_bricks);
+ GF_FREE (str_ret);
+ GF_FREE (all_bricks);
gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 51fa993e9e9..4540bf3e272 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -144,19 +144,16 @@ out:
if (0 != ret) {
if (ctx && ctx->hostname)
GF_FREE (ctx->hostname);
- if (ctx)
- GF_FREE (ctx);
+ GF_FREE (ctx);
if (dict) {
if ((!dict->extra_stdfree) &&
friend_req->vols.vols_val)
free (friend_req->vols.vols_val);
dict_unref (dict);
} else {
- if (friend_req->vols.vols_val)
- free (friend_req->vols.vols_val);
+ free (friend_req->vols.vols_val);
}
- if (event)
- GF_FREE (event);
+ GF_FREE (event);
} else {
if (peerinfo && (0 == peerinfo->connected))
ret = GLUSTERD_CONNECTION_AWAITED;
@@ -226,8 +223,7 @@ out:
if (0 != ret) {
if (ctx && ctx->hostname)
GF_FREE (ctx->hostname);
- if (ctx)
- GF_FREE (ctx);
+ GF_FREE (ctx);
}
return ret;
@@ -567,8 +563,7 @@ out:
if (ret) {
if (dict)
dict_unref (dict);
- if (req_ctx)
- GF_FREE (req_ctx);
+ GF_FREE (req_ctx);
}
return ret;
}
@@ -605,8 +600,7 @@ glusterd_handle_stage_op (rpcsvc_request_t *req)
ret = glusterd_op_sm_inject_event (GD_OP_EVENT_STAGE_OP, req_ctx);
out:
- if (op_req.buf.buf_val)
- free (op_req.buf.buf_val);//malloced by xdr
+ free (op_req.buf.buf_val);//malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
return ret;
@@ -650,8 +644,7 @@ glusterd_handle_commit_op (rpcsvc_request_t *req)
ret = glusterd_op_init_ctx (op_req.op);
out:
- if (op_req.buf.buf_val)
- free (op_req.buf.buf_val);//malloced by xdr
+ free (op_req.buf.buf_val);//malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
return ret;
@@ -707,8 +700,7 @@ glusterd_handle_cli_probe (rpcsvc_request_t *req)
ret = 0;
}
out:
- if (cli_req.hostname)
- free (cli_req.hostname);//its malloced by xdr
+ free (cli_req.hostname);//its malloced by xdr
if (run_fsm) {
glusterd_friend_sm ();
@@ -787,8 +779,7 @@ out:
cli_req.hostname);
}
- if (cli_req.hostname)
- free (cli_req.hostname);//malloced by xdr
+ free (cli_req.hostname);//malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -1234,8 +1225,7 @@ glusterd_fsm_log_send_resp (rpcsvc_request_t *req, int op_ret,
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf1_cli_fsm_log_rsp);
- if (rsp.fsm_log.fsm_log_val)
- GF_FREE (rsp.fsm_log.fsm_log_val);
+ GF_FREE (rsp.fsm_log.fsm_log_val);
gf_log ("glusterd", GF_LOG_DEBUG, "Responded, ret: %d", ret);
@@ -1287,8 +1277,7 @@ glusterd_handle_fsm_log (rpcsvc_request_t *req)
ret = glusterd_sm_tr_log_add_to_dict (dict, log);
out:
(void)glusterd_fsm_log_send_resp (req, ret, msg, dict);
- if (cli_req.name)
- free (cli_req.name);//malloced by xdr
+ free (cli_req.name);//malloced by xdr
if (dict)
dict_unref (dict);
@@ -1415,8 +1404,7 @@ glusterd_op_stage_send_resp (rpcsvc_request_t *req,
gf_log ("glusterd", GF_LOG_INFO,
"Responded to stage, ret: %d", ret);
- if (rsp.dict.dict_val)
- GF_FREE (rsp.dict.dict_val);
+ GF_FREE (rsp.dict.dict_val);
return ret;
}
@@ -1457,8 +1445,7 @@ glusterd_op_commit_send_resp (rpcsvc_request_t *req,
"Responded to commit, ret: %d", ret);
out:
- if (rsp.dict.dict_val)
- GF_FREE (rsp.dict.dict_val);
+ GF_FREE (rsp.dict.dict_val);
return ret;
}
@@ -1489,8 +1476,7 @@ glusterd_handle_incoming_friend_req (rpcsvc_request_t *req)
}
out:
- if (friend_req.hostname)
- free (friend_req.hostname);//malloced by xdr
+ free (friend_req.hostname);//malloced by xdr
if (run_fsm) {
glusterd_friend_sm ();
@@ -1527,10 +1513,8 @@ glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req)
remote_hostname, friend_req.port);
out:
- if (friend_req.hostname)
- free (friend_req.hostname);//malloced by xdr
- if (friend_req.vols.vols_val)
- free (friend_req.vols.vols_val);//malloced by xdr
+ free (friend_req.hostname);//malloced by xdr
+ free (friend_req.vols.vols_val);//malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -1709,8 +1693,7 @@ out:
free (friend_req.friends.friends_val);//malloced by xdr
dict_unref (dict);
} else {
- if (friend_req.friends.friends_val)
- free (friend_req.friends.friends_val);//malloced by xdr
+ free (friend_req.friends.friends_val);//malloced by xdr
}
glusterd_friend_sm ();
@@ -1802,8 +1785,7 @@ respond:
rsp.op_ret, rsp.op_errno, ret);
out:
- if (probe_req.hostname)
- free (probe_req.hostname);//malloced by xdr
+ free (probe_req.hostname);//malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -1863,8 +1845,7 @@ out:
if (ret && dict)
dict_unref (dict);
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val);
+ free (cli_req.dict.dict_val);
if (ret)
ret = glusterd_op_send_cli_response (cli_op, ret, 0, req,
NULL, "operation failed");
@@ -2380,8 +2361,7 @@ glusterd_xfer_friend_add_resp (rpcsvc_request_t *req, char *hostname, int port,
gf_log ("glusterd", GF_LOG_INFO,
"Responded to %s (%d), ret: %d", hostname, port, ret);
- if (rsp.hostname)
- GF_FREE (rsp.hostname);
+ GF_FREE (rsp.hostname);
return ret;
}
@@ -2488,8 +2468,7 @@ out:
ret = glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf1_cli_peer_list_rsp);
- if (rsp.friends.friends_val)
- GF_FREE (rsp.friends.friends_val);
+ GF_FREE (rsp.friends.friends_val);
return ret;
}
@@ -2596,8 +2575,7 @@ out:
if (volumes)
dict_unref (volumes);
- if (rsp.dict.dict_val)
- GF_FREE (rsp.dict.dict_val);
+ GF_FREE (rsp.dict.dict_val);
return ret;
}
@@ -2663,8 +2641,7 @@ out:
if (ret)
ret = glusterd_op_send_cli_response (cli_op, ret, 0, req,
NULL, "operation failed");
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val);
+ free (cli_req.dict.dict_val);
return ret;
}
@@ -2730,8 +2707,7 @@ out:
if (ret)
ret = glusterd_op_send_cli_response (cli_op, ret, 0, req,
NULL, "operation failed");
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val);
+ free (cli_req.dict.dict_val);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index 2d9dd8ada7e..42b0ad3ea5d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -113,8 +113,7 @@ build_volfile_path (const char *volname, char *path,
ret = 1;
out:
- if (free_ptr)
- GF_FREE (free_ptr);
+ GF_FREE (free_ptr);
return ret;
}
@@ -213,10 +212,8 @@ fail:
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_gf_getspec_rsp);
- if (args.key)
- free (args.key);//malloced by xdr
- if (rsp.spec)
- free (rsp.spec);
+ free (args.key);//malloced by xdr
+ free (rsp.spec);
return 0;
}
@@ -276,8 +273,7 @@ fail:
(xdrproc_t)xdr_gf_event_notify_rsp);
if (dict)
dict_unref (dict);
- if (args.dict.dict_val)
- free (args.dict.dict_val);//malloced by xdr
+ free (args.dict.dict_val);//malloced by xdr
return 0;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index ab8e0700524..7bc93246822 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -346,8 +346,7 @@ glusterd_hooks_run_hooks (char *hooks_path, glusterd_op_t op, dict_t *op_ctx,
out:
if (lines) {
for (lineno = 0; lineno < line_count+1; lineno++)
- if (lines[lineno])
- GF_FREE (lines[lineno]);
+ GF_FREE (lines[lineno]);
GF_FREE (lines);
}
@@ -437,11 +436,9 @@ glusterd_hooks_stub_cleanup (glusterd_hooks_stub_t *stub)
if (stub->op_ctx)
dict_unref (stub->op_ctx);
- if (stub->scriptdir)
- GF_FREE (stub->scriptdir);
+ GF_FREE (stub->scriptdir);
- if (stub)
- GF_FREE (stub);
+ GF_FREE (stub);
}
static void*
diff --git a/xlators/mgmt/glusterd/src/glusterd-log-ops.c b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
index 2056c84b53a..3ac78a917f2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-log-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-log-ops.c
@@ -92,8 +92,7 @@ out:
ret = glusterd_op_send_cli_response (cli_op, ret, 0, req,
NULL, "operation failed");
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val);
+ free (cli_req.dict.dict_val);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
index 7b4b09a6c2a..82fdfb81f33 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c
@@ -697,8 +697,7 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno)
*path = cookie;
}
- if (mtptemp)
- GF_FREE (mtptemp);
+ GF_FREE (mtptemp);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index afe1efd479a..26817d4e3cc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -489,8 +489,7 @@ out:
if (val_dict)
dict_unref (val_dict);
- if (key_fixed)
- GF_FREE (key_fixed);
+ GF_FREE (key_fixed);
if (ret) {
if (!(*op_errstr)) {
@@ -568,8 +567,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
}
out:
- if (key_fixed)
- GF_FREE (key_fixed);
+ GF_FREE (key_fixed);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
@@ -959,8 +957,7 @@ glusterd_options_reset (glusterd_volinfo_t *volinfo, char *key,
ret = 0;
out:
- if (key_fixed)
- GF_FREE (key_fixed);
+ GF_FREE (key_fixed);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}
@@ -1235,8 +1232,7 @@ glusterd_op_set_volume (dict_t *dict)
ret = 0;
out:
- if (key_fixed)
- GF_FREE (key_fixed);
+ GF_FREE (key_fixed);
gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index cef89b49a63..75c72abcc93 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -228,8 +228,7 @@ pmap_registry_bind (xlator_t *this, int port, const char *brickname,
p = port;
pmap->ports[p].type = type;
- if (pmap->ports[p].brickname)
- free (pmap->ports[p].brickname);
+ free (pmap->ports[p].brickname);
pmap->ports[p].brickname = strdup (brickname);
pmap->ports[p].type = type;
pmap->ports[p].xprt = xprt;
@@ -281,8 +280,7 @@ remove:
gf_log ("pmap", GF_LOG_INFO, "removing brick %s on port %d",
pmap->ports[p].brickname, p);
- if (pmap->ports[p].brickname)
- free (pmap->ports[p].brickname);
+ free (pmap->ports[p].brickname);
pmap->ports[p].brickname = NULL;
pmap->ports[p].xprt = NULL;
@@ -317,8 +315,7 @@ gluster_pmap_portbybrick (rpcsvc_request_t *req)
fail:
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_pmap_port_by_brick_rsp);
- if (args.brick)
- free (args.brick);//malloced by xdr
+ free (args.brick);//malloced by xdr
return 0;
}
@@ -377,8 +374,7 @@ gluster_pmap_signup (rpcsvc_request_t *req)
fail:
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_pmap_signup_rsp);
- if (args.brick)
- free (args.brick);//malloced by xdr
+ free (args.brick);//malloced by xdr
return 0;
}
@@ -405,8 +401,7 @@ gluster_pmap_signin (rpcsvc_request_t *req)
fail:
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_pmap_signin_rsp);
- if (args.brick)
- free (args.brick);//malloced by xdr
+ free (args.brick);//malloced by xdr
if (!ret)
glusterd_brick_update_signin (brickinfo, _gf_true);
@@ -439,8 +434,7 @@ gluster_pmap_signout (rpcsvc_request_t *req)
fail:
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,
(xdrproc_t)xdr_pmap_signout_rsp);
- if (args.brick)
- free (args.brick);//malloced by xdr
+ free (args.brick);//malloced by xdr
if (!ret)
glusterd_brick_update_signin (brickinfo, _gf_false);
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index b063421ec1a..8d034c455c4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -237,8 +237,7 @@ _glusterd_quota_remove_limits (char **quota_limits, char *path,
}
out:
- if (limits)
- GF_FREE (limits);
+ GF_FREE (limits);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index e57e687c34d..c9397b394ac 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -199,8 +199,7 @@ glusterd_defrag_notify (struct rpc_clnt *rpc, void *mydata,
if (defrag->cbk_fn)
defrag->cbk_fn (volinfo, volinfo->defrag_status);
- if (defrag)
- GF_FREE (defrag);
+ GF_FREE (defrag);
gf_log ("", GF_LOG_DEBUG, "%s got RPC_CLNT_DISCONNECT",
rpc->conn.trans->name);
break;
@@ -487,8 +486,7 @@ out:
NULL, "operation failed");
}
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val);//malloced by xdr
+ free (cli_req.dict.dict_val);//malloced by xdr
return 0;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 067196952ce..5bd6a55b95b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -156,8 +156,7 @@ glusterd_handle_replace_brick (rpcsvc_request_t *req)
out:
if (ret && dict)
dict_unref (dict);
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val);//malloced by xdr
+ free (cli_req.dict.dict_val);//malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -500,8 +499,7 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
ret = 0;
out:
- if (dup_dstbrick)
- GF_FREE (dup_dstbrick);
+ GF_FREE (dup_dstbrick);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
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;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 1fe78a14995..951277f6322 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -100,8 +100,7 @@ glusterd_destroy_probe_ctx (glusterd_probe_ctx_t *ctx)
if (!ctx)
return;
- if (ctx->hostname)
- GF_FREE (ctx->hostname);
+ GF_FREE (ctx->hostname);
GF_FREE (ctx);
}
@@ -113,8 +112,7 @@ glusterd_destroy_friend_req_ctx (glusterd_friend_req_ctx_t *ctx)
if (ctx->vols)
dict_unref (ctx->vols);
- if (ctx->hostname)
- GF_FREE (ctx->hostname);
+ GF_FREE (ctx->hostname);
GF_FREE (ctx);
}
@@ -123,8 +121,7 @@ glusterd_destroy_friend_update_ctx (glusterd_friend_update_ctx_t *ctx)
{
if (!ctx)
return;
- if (ctx->hostname)
- GF_FREE (ctx->hostname);
+ GF_FREE (ctx->hostname);
GF_FREE (ctx);
}
@@ -257,12 +254,9 @@ glusterd_ac_reverse_probe_begin (glusterd_friend_sm_event_t *event, void *ctx)
out:
if (ret) {
- if (new_event)
- GF_FREE (new_event);
- if (new_ev_ctx->hostname)
- GF_FREE (new_ev_ctx->hostname);
- if (new_ev_ctx)
- GF_FREE (new_ev_ctx);
+ GF_FREE (new_event);
+ GF_FREE (new_ev_ctx->hostname);
+ GF_FREE (new_ev_ctx);
}
gf_log ("", GF_LOG_DEBUG, "returning with %d", ret);
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index a70256c398f..6d707878a18 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1222,8 +1222,7 @@ out:
handle->read = NULL;
}
- if (free_str)
- GF_FREE (free_str);
+ GF_FREE (free_str);
return ret;
}
@@ -1304,11 +1303,8 @@ out:
close (fd);
if (ret == -1) {
- if (spath)
- GF_FREE (spath);
- if (shandle) {
- GF_FREE (shandle);
- }
+ GF_FREE (spath);
+ GF_FREE (shandle);
}
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1454,8 +1450,7 @@ glusterd_retrieve_uuid ()
uuid_parse (uuid_str, priv->uuid);
out:
- if (uuid_str)
- GF_FREE (uuid_str);
+ GF_FREE (uuid_str);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}
@@ -1616,8 +1611,7 @@ out:
*value = NULL;
}
}
- if (free_str)
- GF_FREE (free_str);
+ GF_FREE (free_str);
if (op_errno)
*op_errno = store_errno;
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 2b2e9d2e69d..629829283ad 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -306,8 +306,7 @@ gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, uuid_t my_uuid, uuid_t recv_uuid,
if (args.errstr && errstr)
*errstr = args.errstr;
- else if (args.errstr)
- GF_FREE (args.errstr);
+ else GF_FREE (args.errstr);
if (args.dict && dict_in)
*dict_in = args.dict;
@@ -406,8 +405,7 @@ gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, uuid_t my_uuid, uuid_t recv_uuid
if (args.errstr && errstr)
*errstr = args.errstr;
- else if (args.errstr)
- GF_FREE (args.errstr);
+ else GF_FREE (args.errstr);
if (args.dict && dict_in)
*dict_in = args.dict;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index ab1156178b6..feb81d8de80 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -561,16 +561,14 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo)
new_volinfo->dict = dict_new ();
if (!new_volinfo->dict) {
- if (new_volinfo)
- GF_FREE (new_volinfo);
+ GF_FREE (new_volinfo);
goto out;
}
new_volinfo->gsync_slaves = dict_new ();
if (!new_volinfo->gsync_slaves) {
- if (new_volinfo)
- GF_FREE (new_volinfo);
+ GF_FREE (new_volinfo);
goto out;
}
@@ -591,11 +589,9 @@ glusterd_auth_cleanup (glusterd_volinfo_t *volinfo) {
GF_ASSERT (volinfo);
- if (volinfo->auth.username)
- GF_FREE (volinfo->auth.username);
+ GF_FREE (volinfo->auth.username);
- if (volinfo->auth.password)
- GF_FREE (volinfo->auth.password);
+ GF_FREE (volinfo->auth.password);
}
char *
@@ -643,8 +639,7 @@ glusterd_brickinfo_delete (glusterd_brickinfo_t *brickinfo)
list_del_init (&brickinfo->brick_list);
- if (brickinfo->logfile)
- GF_FREE (brickinfo->logfile);
+ GF_FREE (brickinfo->logfile);
GF_FREE (brickinfo);
ret = 0;
@@ -689,8 +684,7 @@ glusterd_volinfo_delete (glusterd_volinfo_t *volinfo)
dict_unref (volinfo->dict);
if (volinfo->gsync_slaves)
dict_unref (volinfo->gsync_slaves);
- if (volinfo->logdir)
- GF_FREE (volinfo->logdir);
+ GF_FREE (volinfo->logdir);
glusterd_auth_cleanup (volinfo);
@@ -779,8 +773,7 @@ glusterd_brickinfo_from_brick (char *brick,
ret = 0;
out:
- if (tmp_host)
- GF_FREE (tmp_host);
+ GF_FREE (tmp_host);
if (tmp_host)
GF_FREE (tmp_path);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
@@ -877,10 +870,8 @@ glusterd_volume_brickinfo_get_by_brick (char *brick,
ret = glusterd_volume_brickinfo_get (NULL, hostname, path, volinfo,
brickinfo, path_match);
out:
- if (tmp_host)
- GF_FREE (tmp_host);
- if (tmp_path)
- GF_FREE (tmp_path);
+ GF_FREE (tmp_host);
+ GF_FREE (tmp_path);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}
@@ -917,8 +908,7 @@ glusterd_friend_cleanup (glusterd_peerinfo_t *peerinfo)
peerinfo->rpc = rpc_clnt_unref (peerinfo->rpc);
peerinfo->rpc = NULL;
if (peerctx) {
- if (peerctx->errstr)
- GF_FREE (peerctx->errstr);
+ GF_FREE (peerctx->errstr);
GF_FREE (peerctx);
}
}
@@ -1482,8 +1472,7 @@ glusterd_sort_and_redirect (const char *src_filepath, int dest_fd)
ret = 0;
out:
- if (lines)
- GF_FREE (lines);
+ GF_FREE (lines);
return ret;
}
@@ -3148,8 +3137,7 @@ glusterd_remote_hostname_get (rpcsvc_request_t *req, char *remote_host, int len)
out:
- if (tmp_host)
- GF_FREE (tmp_host);
+ GF_FREE (tmp_host);
return ret;
}
@@ -3635,8 +3623,7 @@ glusterd_get_brick_root (char *path, char **mount_point)
return 0;
err:
- if (*mount_point)
- GF_FREE (*mount_point);
+ GF_FREE (*mount_point);
return -1;
}
@@ -3818,8 +3805,7 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo,
ret = dict_set_dynstr (dict, key, mnt_options);
out:
- if (mnt_pt)
- GF_FREE (mnt_pt);
+ GF_FREE (mnt_pt);
return ret;
}
#endif
@@ -4667,8 +4653,7 @@ glusterd_sm_tr_log_delete (glusterd_sm_tr_log_t *log)
{
if (!log)
return;
- if (log->transitions)
- GF_FREE (log->transitions);
+ GF_FREE (log->transitions);
return;
}
@@ -4766,8 +4751,7 @@ glusterd_peer_destroy (glusterd_peerinfo_t *peerinfo)
}
list_del_init (&peerinfo->uuid_list);
- if (peerinfo->hostname)
- GF_FREE (peerinfo->hostname);
+ GF_FREE (peerinfo->hostname);
glusterd_sm_tr_log_delete (&peerinfo->sm_log);
GF_FREE (peerinfo);
peerinfo = NULL;
@@ -5078,8 +5062,7 @@ glusterd_set_dump_options (char *dumpoptions_path, char *options,
out:
if (fp)
fclose (fp);
- if (dup_options)
- GF_FREE (dup_options);
+ GF_FREE (dup_options);
return ret;
}
@@ -5231,8 +5214,7 @@ out:
if (pidfile)
fclose (pidfile);
unlink (dumpoptions_path);
- if (dup_options)
- GF_FREE (dup_options);
+ GF_FREE (dup_options);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index c7924e5c289..1e22560aaed 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -295,8 +295,7 @@ xlator_instantiate_va (const char *type, const char *format, va_list arg)
error:
gf_log ("", GF_LOG_ERROR, "creating xlator of type %s failed",
type);
- if (volname)
- GF_FREE (volname);
+ GF_FREE (volname);
if (xl)
xlator_destroy (xl);
@@ -619,8 +618,7 @@ volopt_trie (char *key, char **hint)
}
out:
- if (patt[0])
- GF_FREE (patt[0]);
+ GF_FREE (patt[0]);
if (ret)
*hint = NULL;
@@ -1244,8 +1242,7 @@ volgen_write_volfile (volgen_graph_t *graph, char *filename)
error:
- if (ftmp)
- GF_FREE (ftmp);
+ GF_FREE (ftmp);
if (f)
fclose (f);
@@ -2407,8 +2404,7 @@ volgen_graph_build_dht_cluster (volgen_graph_t *graph,
}
ret = 0;
out:
- if (decommissioned_children)
- GF_FREE (decommissioned_children);
+ GF_FREE (decommissioned_children);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 0bbadad3d10..f706ac67436 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -234,8 +234,7 @@ out:
ret = 0; //Client response sent, prevent second response
}
- if (free_ptr)
- GF_FREE(free_ptr);
+ GF_FREE(free_ptr);
glusterd_volume_brickinfos_delete (&tmpvolinfo);
if (brickinfo)
@@ -299,8 +298,7 @@ glusterd_handle_cli_start_volume (rpcsvc_request_t *req)
out:
if (ret && dict)
dict_unref (dict);
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val); //its malloced by xdr
+ free (cli_req.dict.dict_val); //its malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -362,8 +360,7 @@ glusterd_handle_cli_stop_volume (rpcsvc_request_t *req)
((ret)?"FAILED":"SUCCESS"));
out:
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val); //its malloced by xdr
+ free (cli_req.dict.dict_val); //its malloced by xdr
glusterd_friend_sm ();
glusterd_op_sm ();
@@ -429,8 +426,7 @@ glusterd_handle_cli_delete_volume (rpcsvc_request_t *req)
((ret) ? "FAILED" : "SUCCESS"));
out:
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val); //its malloced by xdr
+ free (cli_req.dict.dict_val); //its malloced by xdr
if (ret && dict)
dict_unref (dict);
@@ -594,8 +590,7 @@ glusterd_handle_cli_statedump_volume (rpcsvc_request_t *req)
out:
if (ret && dict)
dict_unref (dict);
- if (cli_req.dict.dict_val)
- free (cli_req.dict.dict_val);
+ free (cli_req.dict.dict_val);
glusterd_friend_sm ();
glusterd_op_sm();
@@ -731,8 +726,7 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr)
brick_info = NULL;
}
out:
- if (free_ptr)
- GF_FREE (free_ptr);
+ GF_FREE (free_ptr);
if (brick_info)
glusterd_brickinfo_delete (brick_info);
gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
@@ -1437,8 +1431,7 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
list_add_tail (&volinfo->vol_list, &priv->volumes);
vol_added = _gf_true;
out:
- if (free_ptr)
- GF_FREE(free_ptr);
+ GF_FREE(free_ptr);
if (!vol_added && volinfo)
glusterd_volinfo_delete (volinfo);
return ret;
@@ -1932,11 +1925,9 @@ out:
GF_FREE (xl_opts);
}
- if (cmd_str)
- GF_FREE (cmd_str);
+ GF_FREE (cmd_str);
- if (mntpt)
- GF_FREE (mntpt);
+ GF_FREE (mntpt);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index a3869e6317f..87914ee4998 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1061,8 +1061,7 @@ fini (xlator_t *this)
goto out;
conf = this->private;
- if (conf->pmap)
- FREE (conf->pmap);
+ FREE (conf->pmap);
if (conf->handle)
glusterd_store_handle_destroy (conf->handle);
glusterd_sm_tr_log_delete (&conf->op_sm_log);