in dcb_final_free the dcb->session NULL check protects the access to dcb->session->router_session and all the code below
This commit is contained in:
@ -250,38 +250,40 @@ void* rsession = NULL;
|
|||||||
/**
|
/**
|
||||||
* Terminate router session.
|
* Terminate router session.
|
||||||
*/
|
*/
|
||||||
if (dcb->session)
|
if (dcb->session) {
|
||||||
service = dcb->session->service;
|
service = dcb->session->service;
|
||||||
|
|
||||||
if (service != NULL &&
|
if (service != NULL &&
|
||||||
service->router != NULL &&
|
service->router != NULL &&
|
||||||
dcb->session->router_session != NULL)
|
dcb->session->router_session != NULL)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Protect call of closeSession.
|
* Protect call of closeSession.
|
||||||
*/
|
*/
|
||||||
spinlock_acquire(&dcb->session->ses_lock);
|
spinlock_acquire(&dcb->session->ses_lock);
|
||||||
rsession = dcb->session->router_session;
|
rsession = dcb->session->router_session;
|
||||||
spinlock_release(&dcb->session->ses_lock);
|
spinlock_release(&dcb->session->ses_lock);
|
||||||
if (rsession != NULL) {
|
if (rsession != NULL) {
|
||||||
service->router->closeSession(
|
service->router->closeSession(
|
||||||
service->router_instance,
|
service->router_instance,
|
||||||
rsession);
|
rsession);
|
||||||
} else {
|
} else {
|
||||||
skygw_log_write_flush(
|
skygw_log_write_flush(
|
||||||
LOGFILE_TRACE,
|
LOGFILE_TRACE,
|
||||||
"%lu [dcb_final_free] rsession was NULL in "
|
"%lu [dcb_final_free] rsession was NULL in "
|
||||||
"dcb_close.",
|
"dcb_close.",
|
||||||
pthread_self());
|
pthread_self());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Terminate client session.
|
/**
|
||||||
*/
|
* Terminate client session.
|
||||||
if (dcb->session) {
|
*/
|
||||||
SESSION *local_session = dcb->session;
|
{
|
||||||
dcb->session = NULL;
|
SESSION *local_session = dcb->session;
|
||||||
session_free(local_session);
|
dcb->session = NULL;
|
||||||
|
session_free(local_session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcb->protocol)
|
if (dcb->protocol)
|
||||||
|
Reference in New Issue
Block a user