Skip to content

Commit

Permalink
Merge pull request #4076 from sysown/v2.x_crash_fix_debug
Browse files Browse the repository at this point in the history
Avoid null pointer mysql connection access
  • Loading branch information
renecannao authored Jan 12, 2023
2 parents 3998873 + 6c104fb commit cb2ca9c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/MySQL_Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,16 @@ MYSQL * MySQL_Monitor_Connection_Pool::get_connection(char *hostname, int port,
break;
}
#ifdef DEBUG
for (unsigned int j=0; j<conns->len; j++) {
MYSQL *my1 = (MYSQL *)conns->index(j);
assert(my!=my1);
assert(my->net.fd!=my1->net.fd);
}
//proxy_info("Registering MYSQL with FD %d from mmsd %p and MYSQL %p\n", my->net.fd, mmsd, my);
if (my)
if (my) {
for (unsigned int j=0; j<conns->len; j++) {
MYSQL *my1 = (MYSQL *)conns->index(j);
assert(my!=my1);
assert(my->net.fd!=my1->net.fd);
}
//proxy_info("Registering MYSQL with FD %d from mmsd %p and MYSQL %p\n", my->net.fd, mmsd, my);

conns->add(my);
}
#endif // DEBUG
}
#ifdef DEBUG
Expand Down

0 comments on commit cb2ca9c

Please sign in to comment.