diff options
author | Raghavendra G <raghavendra@zresearch.com> | 2009-04-14 02:53:09 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-14 15:31:35 +0530 |
commit | d77279ef04ca75ab9715864274567d1ce0ce66a6 (patch) | |
tree | 4d32cd9a1fab4a917dec125ad113c51a2bc11b11 /xlators/protocol | |
parent | 3baa437e9980e7dac9893d6c11ccc1623a5faee2 (diff) |
server-helpers: Add check for NULL connection arguement being passed in helpers.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 8c2d5a39d50..dd7e54fb66b 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -421,7 +421,13 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn) uint32_t fd_count = 0; fd_t **fds = NULL; int32_t i = 0; - + + if (conn == NULL) { + gf_log (this->name, GF_LOG_DEBUG, + "connection is NULL"); + goto out; + } + bound_xl = (xlator_t *) (conn->bound_xl); if (bound_xl) { @@ -554,6 +560,7 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn) STACK_DESTROY (frame->root); } +out: return 0; } @@ -574,7 +581,13 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn) int32_t i = 0; fd_t **fds = NULL; uint32_t fd_count = 0; - + + if (conn == NULL) { + gf_log (this->name, GF_LOG_DEBUG, + "connection is NULL"); + ret = 0; + goto out; + } bound_xl = (xlator_t *) (conn->bound_xl); @@ -713,6 +726,7 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn) FREE (conn->id); FREE (conn); +out: return ret; } @@ -761,6 +775,12 @@ server_connection_put (xlator_t *this, server_connection_t *conn) server_conf_t *conf = NULL; server_connection_t *todel = NULL; + if (conn == NULL) { + gf_log (this->name, GF_LOG_DEBUG, + "connection is NULL"); + goto out; + } + conf = this->private; pthread_mutex_lock (&conf->mutex); @@ -778,5 +798,6 @@ server_connection_put (xlator_t *this, server_connection_t *conn) server_connection_destroy (this, todel); } +out: return; } |