dcb.b:dcb_final_free:replaced ((dcb->flags & DCBF_CLONE)==0) with macro !DCB_IS_CLONE(dcb)

readwritesplit.h:Removed invalid macros which assumed that ROUTER_CLIENT_SES->rses_backend_ref always pointed to valid and used backend reference and thus included potential risk of NULL-pointer refernce.
mysql_backend.c and mysql_client.c:avoid executing CHK_PROTOCOL(p) after original DCB has been released the memory.
readwritesplit.c:Replaced RSES_CLEINT_DCB macro with a function which returns client DCB for a given router client session.
This commit is contained in:
VilhoRaatikka
2014-12-23 16:10:27 +02:00
parent d2281d6391
commit ff5fe23ce6
7 changed files with 39 additions and 52 deletions

View File

@ -1395,20 +1395,13 @@ gw_client_close(DCB *dcb)
dcb->state == DCB_STATE_NOPOLLING ||
dcb->state == DCB_STATE_ZOMBIE)
{
CHK_PROTOCOL(protocol);
if (!DCB_IS_CLONE(dcb)) CHK_PROTOCOL(protocol);
}
#endif
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
"%lu [gw_client_close]",
pthread_self())));
/**
* Since only protocol pointer is copied from original DCB to clone in
* dcb_clone, only dcb_close for the original DCB closes protocol.
*/
if (!DCB_IS_CLONE(dcb))
{
mysql_protocol_done(dcb);
}
mysql_protocol_done(dcb);
session = dcb->session;
/**
* session may be NULL if session_alloc failed.