summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/auth-glusterfs.c6
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c3
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c22
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c24
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c8
-rw-r--r--rpc/rpc-transport/socket/src/socket.c7
-rw-r--r--rpc/xdr/src/xdr-nfs3.c6
7 files changed, 24 insertions, 52 deletions
diff --git a/rpc/rpc-lib/src/auth-glusterfs.c b/rpc/rpc-lib/src/auth-glusterfs.c
index 5f41c8296..c08871466 100644
--- a/rpc/rpc-lib/src/auth-glusterfs.c
+++ b/rpc/rpc-lib/src/auth-glusterfs.c
@@ -213,10 +213,8 @@ int auth_glusterfs_v2_authenticate (rpcsvc_request_t *req, void *priv)
ret = RPCSVC_AUTH_ACCEPT;
err:
/* TODO: instead use alloca() for these variables */
- if (au.groups.groups_val)
- free (au.groups.groups_val);
- if (au.lk_owner.lk_owner_val)
- free (au.lk_owner.lk_owner_val);
+ free (au.groups.groups_val);
+ free (au.lk_owner.lk_owner_val);
return ret;
}
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index 9a65f09c0..f099fb6b5 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -1721,8 +1721,7 @@ rpc_clnt_transport_unix_options_build (dict_t **options, char *filepath)
*options = dict;
out:
if (ret) {
- if (fpath)
- GF_FREE (fpath);
+ GF_FREE (fpath);
if (dict)
dict_unref (dict);
}
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 4b6937424..6d06f0fb0 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -322,19 +322,15 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
return_trans = trans;
- if (name)
- GF_FREE (name);
+ GF_FREE (name);
- if (vol_opt)
- GF_FREE (vol_opt);
+ GF_FREE (vol_opt);
return return_trans;
fail:
if (trans) {
- if (trans->name) {
- GF_FREE (trans->name);
- }
+ GF_FREE (trans->name);
if (trans->dl_handle)
dlclose (trans->dl_handle);
@@ -342,11 +338,9 @@ fail:
GF_FREE (trans);
}
- if (name)
- GF_FREE (name);
+ GF_FREE (name);
- if (vol_opt)
- GF_FREE (vol_opt);
+ GF_FREE (vol_opt);
return NULL;
}
@@ -433,8 +427,7 @@ rpc_transport_destroy (rpc_transport_t *this)
pthread_mutex_destroy (&this->lock);
- if (this->name)
- GF_FREE (this->name);
+ GF_FREE (this->name);
if (this->dl_handle)
dlclose (this->dl_handle);
@@ -615,8 +608,7 @@ rpc_transport_inet_options_build (dict_t **options, const char *hostname,
*options = dict;
out:
if (ret) {
- if (host)
- GF_FREE (host);
+ GF_FREE (host);
if (dict)
dict_unref (dict);
}
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index ee9e1c725..634123426 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -1514,17 +1514,13 @@ rpcsvc_create_listeners (rpcsvc_t *svc, dict_t *options, char *name)
transport_type = NULL;
out:
- if (str)
- GF_FREE (str);
+ GF_FREE (str);
- if (transport_type)
- GF_FREE (transport_type);
+ GF_FREE (transport_type);
- if (tmp)
- GF_FREE (tmp);
+ GF_FREE (tmp);
- if (transport_name)
- GF_FREE (transport_name);
+ GF_FREE (transport_name);
return count;
}
@@ -1812,8 +1808,7 @@ rpcsvc_transport_unix_options_build (dict_t **options, char *filepath)
*options = dict;
out:
if (ret) {
- if (fpath)
- GF_FREE (fpath);
+ GF_FREE (fpath);
if (dict)
dict_unref (dict);
}
@@ -1935,8 +1930,7 @@ rpcsvc_transport_peer_check_search (dict_t *options, char *pattern, char *clstr)
ret = -1;
err:
- if (dup_addrstr)
- GF_FREE (dup_addrstr);
+ GF_FREE (dup_addrstr);
return ret;
}
@@ -2399,8 +2393,7 @@ rpcsvc_transport_privport_check (rpcsvc_t *svc, char *volname,
" allowed");
err:
- if (srchstr)
- GF_FREE (srchstr);
+ GF_FREE (srchstr);
return ret;
}
@@ -2429,8 +2422,7 @@ rpcsvc_volume_allowed (dict_t *options, char *volname)
ret = dict_get_str (options, srchstr, &addrstr);
out:
- if (srchstr)
- GF_FREE (srchstr);
+ GF_FREE (srchstr);
return addrstr;
}
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 3d4dfe362..facc92358 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -196,9 +196,7 @@ gf_rdma_new_post (gf_rdma_device_t *device, int32_t len,
ret = 0;
out:
if (ret != 0) {
- if (post->buf != NULL) {
- free (post->buf);
- }
+ free (post->buf);
GF_FREE (post);
post = NULL;
@@ -2931,9 +2929,7 @@ out:
*readch = NULL;
}
- if (write_ary != NULL) {
- GF_FREE (write_ary);
- }
+ GF_FREE (write_ary);
}
return ret;
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 655e806ab..9db09d77e 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -467,9 +467,7 @@ __socket_reset (rpc_transport_t *this)
iobuf_unref (priv->incoming.iobuf);
}
- if (priv->incoming.request_info != NULL) {
- GF_FREE (priv->incoming.request_info);
- }
+ GF_FREE (priv->incoming.request_info);
memset (&priv->incoming, 0, sizeof (priv->incoming));
@@ -1102,8 +1100,7 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
well and good, we don't need to worry about */
xdr_gfs3_read_rsp (&xdr, &read_rsp);
- if (read_rsp.xdata.xdata_val)
- free (read_rsp.xdata.xdata_val);
+ free (read_rsp.xdata.xdata_val);
/* need to round off to proper roof (%4), as XDR packing pads
the end of opaque object with '0' */
diff --git a/rpc/xdr/src/xdr-nfs3.c b/rpc/xdr/src/xdr-nfs3.c
index 35fca59ff..b6402b07c 100644
--- a/rpc/xdr/src/xdr-nfs3.c
+++ b/rpc/xdr/src/xdr-nfs3.c
@@ -1848,12 +1848,10 @@ xdr_free_exports_list (struct exportnode *first)
while (first) {
elist = first->ex_next;
- if (first->ex_dir)
- GF_FREE (first->ex_dir);
+ GF_FREE (first->ex_dir);
if (first->ex_groups) {
- if (first->ex_groups->gr_name)
- GF_FREE (first->ex_groups->gr_name);
+ GF_FREE (first->ex_groups->gr_name);
GF_FREE (first->ex_groups);
}