Commit 581cbb3b authored by unknown's avatar unknown

fixed double-free bug in COM_CHANGE_USER

parent 33117252
...@@ -793,6 +793,7 @@ bool do_command(THD *thd) ...@@ -793,6 +793,7 @@ bool do_command(THD *thd)
char *save_user= thd->user; char *save_user= thd->user;
char *save_priv_user= thd->priv_user; char *save_priv_user= thd->priv_user;
char *save_db= thd->db; char *save_db= thd->db;
thd->user=0;
if ((uint) ((uchar*) db - net->read_pos) > packet_length) if ((uint) ((uchar*) db - net->read_pos) > packet_length)
{ // Check if protocol is ok { // Check if protocol is ok
...@@ -802,7 +803,6 @@ bool do_command(THD *thd) ...@@ -802,7 +803,6 @@ bool do_command(THD *thd)
if (check_user(thd, COM_CHANGE_USER, user, passwd, db, 0)) if (check_user(thd, COM_CHANGE_USER, user, passwd, db, 0))
{ // Restore old user { // Restore old user
x_free(thd->user); x_free(thd->user);
x_free(thd->db);
thd->master_access=save_master_access; thd->master_access=save_master_access;
thd->db_access=save_db_access; thd->db_access=save_db_access;
thd->db=save_db; thd->db=save_db;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment