Fix null pointer

This commit is contained in:
wangbin579 2019-07-05 15:19:24 +03:00
parent 1ff787bb69
commit 259e7a7f1e
3 changed files with 5 additions and 5 deletions

View File

@ -326,7 +326,7 @@ proxy_c_read_query_result(network_mysqld_con *con)
break;
case INJ_ID_CHANGE_DB: {
network_mysqld_com_query_result_t *query = con->parse.data;
if (query->query_status == MYSQLD_PACKET_OK) {
if (query && query->query_status == MYSQLD_PACKET_OK) {
g_string_truncate(con->server->default_db, 0);
g_string_append_len(con->server->default_db, S(con->client->default_db));
g_debug("%s: set server db to client db for con:%p", G_STRLOC, con);
@ -1861,7 +1861,7 @@ NETWORK_MYSQLD_PLUGIN_PROTO(proxy_send_query_result)
if (st->sql_context->stmt_type == STMT_DROP_DATABASE) {
network_mysqld_com_query_result_t *com_query = con->parse.data;
if (com_query->query_status == MYSQLD_PACKET_OK) {
if (com_query && com_query->query_status == MYSQLD_PACKET_OK) {
if (con->servers != NULL) {
con->server_to_be_closed = 1;
} else if (con->server) {

View File

@ -2184,7 +2184,7 @@ NETWORK_MYSQLD_PLUGIN_PROTO(proxy_send_query_result)
if (context->stmt_type == STMT_DROP_DATABASE) {
network_mysqld_com_query_result_t *com_query = con->parse.data;
if (com_query->query_status == MYSQLD_PACKET_OK) {
if (com_query && com_query->query_status == MYSQLD_PACKET_OK) {
if (con->servers != NULL) {
int i;
for (i = 0; i < con->servers->len; i++) {

View File

@ -4138,11 +4138,11 @@ network_mysqld_read_rw_resp(network_mysqld_con *con, network_socket *server, int
G_STRLOC, con->client->default_db->str, server->default_db->str);
if (con->parse.command == COM_QUERY) {
network_mysqld_com_query_result_t *query = con->parse.data;
if (query->query_status == MYSQLD_PACKET_ERR) {
if (query && query->query_status == MYSQLD_PACKET_ERR) {
disp_err_packet(con, &packet);
}
if (query->warning_count > 0) {
if (query && query->warning_count > 0) {
g_debug("%s warning flag from server:%s is met:%s",
G_STRLOC, server->dst->name->str, con->orig_sql->str);
con->last_warning_met = 1;