Skip to content

Commit

Permalink
Merge pull request #2852 from sysown/v2.0.13-2850
Browse files Browse the repository at this point in the history
Fixes #2850: Segfaults due to access to 'GloMyLogger' and 'GloMTH' when already deinitialized
  • Loading branch information
renecannao authored Jun 7, 2020
2 parents 6f11ea6 + e64885f commit e90ec3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/MySQL_HostGroups_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ static void gtid_async_cb(struct ev_loop *loop, struct ev_async *watcher, int re
}

static void gtid_timer_cb (struct ev_loop *loop, struct ev_timer *timer, int revents) {
if (GloMTH == nullptr) { return; }
ev_timer_stop(loop, timer);
ev_timer_set(timer, __sync_add_and_fetch(&GloMTH->variables.binlog_reader_connect_retry_msec,0)/1000, 0);
if (glovars.shutdown) {
Expand Down
4 changes: 2 additions & 2 deletions lib/MySQL_Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3330,7 +3330,7 @@ int MySQL_Session::handler() {
// break;
case _MYSQL_COM_QUIT:
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Got COM_QUIT packet\n");
GloMyLogger->log_audit_entry(PROXYSQL_MYSQL_AUTH_QUIT, this, NULL);
if (GloMyLogger) { GloMyLogger->log_audit_entry(PROXYSQL_MYSQL_AUTH_QUIT, this, NULL); }
l_free(pkt.size,pkt.ptr);
handler_ret = -1;
return handler_ret;
Expand Down Expand Up @@ -3417,7 +3417,7 @@ int MySQL_Session::handler() {
c=*((unsigned char *)pkt.ptr+sizeof(mysql_hdr));
if (c==_MYSQL_COM_QUIT) {
proxy_error("Unexpected COM_QUIT from client %s . Session_status: %d , client_status: %d Disconnecting it\n", buf, status, client_myds->status);
GloMyLogger->log_audit_entry(PROXYSQL_MYSQL_AUTH_QUIT, this, NULL);
if (GloMyLogger) { GloMyLogger->log_audit_entry(PROXYSQL_MYSQL_AUTH_QUIT, this, NULL); }
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Got COM_QUIT packet\n");
l_free(pkt.size,pkt.ptr);
if (thread) {
Expand Down
2 changes: 1 addition & 1 deletion lib/MySQL_Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3167,7 +3167,7 @@ MySQL_Thread::~MySQL_Thread() {
if (sess->session_type == PROXYSQL_SESSION_ADMIN || sess->session_type == PROXYSQL_SESSION_STATS) {
char _buf[1024];
sprintf(_buf,"%s:%d:%s()", __FILE__, __LINE__, __func__);
GloMyLogger->log_audit_entry(PROXYSQL_MYSQL_AUTH_CLOSE, sess, NULL, _buf);
if (GloMyLogger) { GloMyLogger->log_audit_entry(PROXYSQL_MYSQL_AUTH_CLOSE, sess, NULL, _buf); }
}
delete sess;
}
Expand Down

0 comments on commit e90ec3d

Please sign in to comment.