MXS-2041: Fix crash on failed schemarouter session

When the setting up of filters for a session fails, the DCB is closed and
the client DCB's session pointer is set to NULL. This needs to be checked
in the schemarouter before the `m_client->session` pointer is used.

The act of setting the session pointer to NULL should not be necessary as
the session is freed once the reference count drops down to zero. Due to
the fact that changing this would require moderate changes in session code
means that it should not be done in a patch release as the risks are too
high.
This commit is contained in:
Markus Mäkelä
2018-09-10 22:07:34 +03:00
parent 9c08d78304
commit e15b0e2147

View File

@ -610,7 +610,8 @@ void SchemaRouterSession::handleError(GWBUF* pMessage,
break;
case ERRACT_REPLY_CLIENT:
if (m_client->session->state == SESSION_STATE_ROUTER_READY)
// The session pointer can be NULL if the creation fails when filters are being set up
if (m_client->session && m_client->session->state == SESSION_STATE_ROUTER_READY)
{
m_client->func.write(m_client, gwbuf_clone(pMessage));
}