diff options
author | Praveenkumar Hulakund <praveenkumar.hulakund@oracle.com> | 2013-08-21 10:44:22 +0530 |
---|---|---|
committer | Praveenkumar Hulakund <praveenkumar.hulakund@oracle.com> | 2013-08-21 10:44:22 +0530 |
commit | 39932dcffa9f77f3019673006f54b55dc3f50ef2 (patch) | |
tree | 5c64842b7b3ffcc46f6bbc2bd7bfa57e93d207b2 /sql/sql_db.cc | |
parent | 198f3b466cee289a844cffc453da1d3fb7d7c31a (diff) | |
parent | 10a6aa256e965874b3a307f7d81393078a991544 (diff) | |
download | mariadb-git-39932dcffa9f77f3019673006f54b55dc3f50ef2.tar.gz |
Bug#11765252 - READ OF FREED MEMORY WHEN "USE DB" AND
"SHOW PROCESSLIST"
Merging from 5.1 to 5.5
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index ee02e811f67..ef83239bebf 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -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. */ |