summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/rpc-transport.c
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2017-11-22 17:03:11 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-11-22 16:58:39 +0000
commit50a480701f4bf6885d3811e245a47d99661695d8 (patch)
treec3e4fb52830734fa3c2da0ac2edd93886941d3f8 /rpc/rpc-lib/src/rpc-transport.c
parent8d53be68d8fb4272f0c88fef0a00dad452b941de (diff)
rpc-lib: coverity fixes
Scan URL: https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-11-10-0f524f07/html/ ID: 9 (BAD_SHIFT) ID: 58 (CHECKED_RETURN) ID: 98 (DEAD_CODE) ID: 249, 250, 251, 252 (MIXED_ENUMS) ID: 289, 297 (NULL_RETURNS) ID: 609, 613, 622, 644, 653, 655 (UNUSED_VALUE) ID: 432 (RESOURCE_LEAK) Change-Id: I2349877214dd38b789e08b74be05539f09b751b9 BUG: 789278 Signed-off-by: Milind Changire <mchangir@redhat.com>
Diffstat (limited to 'rpc/rpc-lib/src/rpc-transport.c')
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 4c3d5279fe1..40b5917f9b8 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -175,6 +175,7 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
volume_opt_list_t *vol_opt = NULL;
gf_boolean_t bind_insecure = _gf_false;
xlator_t *this = NULL;
+ gf_boolean_t success = _gf_false;
GF_VALIDATE_OR_GOTO("rpc-transport", options, fail);
GF_VALIDATE_OR_GOTO("rpc-transport", ctx, fail);
@@ -357,26 +358,32 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
GF_FREE (name);
- return return_trans;
+ success = _gf_true;
fail:
- if (trans) {
- GF_FREE (trans->name);
+ if (!success) {
+ if (trans) {
+ GF_FREE (trans->name);
- if (trans->dl_handle)
- dlclose (trans->dl_handle);
+ if (trans->dl_handle)
+ dlclose (trans->dl_handle);
- GF_FREE (trans);
- }
+ GF_FREE (trans);
+ }
- GF_FREE (name);
+ GF_FREE (name);
- if (vol_opt && !list_empty (&vol_opt->list)) {
- list_del_init (&vol_opt->list);
+ return_trans = NULL;
+ }
+
+ if (vol_opt) {
+ if (!list_empty (&vol_opt->list)) {
+ list_del_init (&vol_opt->list);
+ }
GF_FREE (vol_opt);
}
- return NULL;
+ return return_trans;
}