mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#11765252 - READ OF FREED MEMORY WHEN "USE DB" AND
"SHOW PROCESSLIST" Merging from 5.1 to 5.5
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -1302,9 +1302,12 @@ static void mysql_change_db_impl(THD *thd,
|
||||
we just call THD::reset_db(). Since THD::reset_db() does not releases
|
||||
the previous database name, we should do it explicitly.
|
||||
*/
|
||||
my_free(thd->db);
|
||||
|
||||
mysql_mutex_lock(&thd->LOCK_thd_data);
|
||||
if (thd->db)
|
||||
my_free(thd->db);
|
||||
DEBUG_SYNC(thd, "after_freeing_thd_db");
|
||||
thd->reset_db(new_db_name->str, new_db_name->length);
|
||||
mysql_mutex_unlock(&thd->LOCK_thd_data);
|
||||
}
|
||||
|
||||
/* 2. Update security context. */
|
||||
|
Reference in New Issue
Block a user