From 6eee473eba94697953e8b3e1b04fe5ef1de5f474 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 5 Jun 2012 14:15:54 +0530 Subject: core: coverity fixes (mostly resource leak fixes) currently working on obvious resource leak reports in coverity Change-Id: I261f4c578987b16da399ab5a504ad0fda0b176b1 Signed-off-by: Amar Tumballi BUG: 789278 Reviewed-on: http://review.gluster.com/3265 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- rpc/rpc-lib/src/rpc-transport.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'rpc/rpc-lib/src/rpc-transport.c') diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 8da898b61..d0e7834e8 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -257,6 +257,8 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name) goto fail; } + trans->dl_handle = handle; + trans->ops = dlsym (handle, "tops"); if (trans->ops == NULL) { gf_log ("rpc-transport", GF_LOG_ERROR, @@ -319,9 +321,11 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name) return_trans = trans; - if (name) { + if (name) GF_FREE (name); - } + + if (vol_opt) + GF_FREE (vol_opt); return return_trans; @@ -331,12 +335,17 @@ fail: GF_FREE (trans->name); } + if (trans->dl_handle) + dlclose (trans->dl_handle); + GF_FREE (trans); } - if (name) { + if (name) GF_FREE (name); - } + + if (vol_opt) + GF_FREE (vol_opt); return NULL; } @@ -426,6 +435,9 @@ rpc_transport_destroy (rpc_transport_t *this) if (this->name) GF_FREE (this->name); + if (this->dl_handle) + dlclose (this->dl_handle); + GF_FREE (this); fail: return ret; -- cgit