diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index cf40acdac..4de7f9bdd 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -1337,7 +1337,7 @@ MySQL_ResultSet::~MySQL_ResultSet() { free(buffer); buffer=NULL; } - myds->pkt_sid=sid-1; + if (myds) myds->pkt_sid=sid-1; } unsigned int MySQL_ResultSet::add_row(MYSQL_ROW row) { diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index f6082d776..6df624f54 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -720,7 +720,8 @@ __get_pkts_from_client: newsess->client_myds->DSS=STATE_SLEEP; newsess->client_myds->sess=newsess; newsess->client_myds->myds_type=MYDS_FRONTEND; - newsess->client_myds->PSarrayOUT= new PtrSizeArray();; + newsess->client_myds->PSarrayOUT= new PtrSizeArray(); + newsess->thread_session_id=__sync_fetch_and_add(&glovars.thread_id,1); thread->register_session(newsess); newsess->status=WAITING_CLIENT_DATA; MySQL_Connection *myconn=new MySQL_Connection;