server-helpers: Add check for NULL connection arguement being passed in helpers.

Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
This commit is contained in:
Raghavendra G 2009-04-14 02:53:09 -07:00 committed by Anand V. Avati
parent 3baa437e99
commit d77279ef04

View File

@ -421,7 +421,13 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn)
uint32_t fd_count = 0; uint32_t fd_count = 0;
fd_t **fds = NULL; fd_t **fds = NULL;
int32_t i = 0; 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); bound_xl = (xlator_t *) (conn->bound_xl);
if (bound_xl) { if (bound_xl) {
@ -554,6 +560,7 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn)
STACK_DESTROY (frame->root); STACK_DESTROY (frame->root);
} }
out:
return 0; return 0;
} }
@ -574,7 +581,13 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn)
int32_t i = 0; int32_t i = 0;
fd_t **fds = NULL; fd_t **fds = NULL;
uint32_t fd_count = 0; 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); 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->id);
FREE (conn); FREE (conn);
out:
return ret; return ret;
} }
@ -761,6 +775,12 @@ server_connection_put (xlator_t *this, server_connection_t *conn)
server_conf_t *conf = NULL; server_conf_t *conf = NULL;
server_connection_t *todel = NULL; server_connection_t *todel = NULL;
if (conn == NULL) {
gf_log (this->name, GF_LOG_DEBUG,
"connection is NULL");
goto out;
}
conf = this->private; conf = this->private;
pthread_mutex_lock (&conf->mutex); pthread_mutex_lock (&conf->mutex);
@ -778,5 +798,6 @@ server_connection_put (xlator_t *this, server_connection_t *conn)
server_connection_destroy (this, todel); server_connection_destroy (this, todel);
} }
out:
return; return;
} }