Fixed possible null pointer dereferences in mysql_backend.

This commit is contained in:
Markus Makela
2015-06-17 10:05:56 +03:00
parent 2d63aa2842
commit f0aed1f666

View File

@ -1159,13 +1159,14 @@ gw_backend_close(DCB *dcb)
* but client's close and adding client's DCB to zombies list is executed * but client's close and adding client's DCB to zombies list is executed
* only if client's DCB's state does _not_ change in parallel. * only if client's DCB's state does _not_ change in parallel.
*/ */
if(session != NULL)
{
spinlock_acquire(&session->ses_lock); spinlock_acquire(&session->ses_lock);
/** /**
* If session->state is STOPPING, start closing client session. * If session->state is STOPPING, start closing client session.
* Otherwise only this backend connection is closed. * Otherwise only this backend connection is closed.
*/ */
if (session != NULL && if (session->state == SESSION_STATE_STOPPING &&
session->state == SESSION_STATE_STOPPING &&
session->client != NULL) session->client != NULL)
{ {
if (session->client->state == DCB_STATE_POLLING) if (session->client->state == DCB_STATE_POLLING)
@ -1184,6 +1185,7 @@ gw_backend_close(DCB *dcb)
{ {
spinlock_release(&session->ses_lock); spinlock_release(&session->ses_lock);
} }
}
return 1; return 1;
} }