diff options
author | unknown <monty@hundin.mysql.fi> | 2002-10-29 21:59:03 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-10-29 21:59:03 +0200 |
commit | ea3ffb9b3efedc03baf011467a0b84f394b1b19e (patch) | |
tree | 5eb822c41165cc8204269340f47d7a10e2b83d7f /sql/sql_acl.cc | |
parent | 14cbecdc8b53b60dcaf101368bd3df3ae5a7c75e (diff) | |
download | mariadb-git-ea3ffb9b3efedc03baf011467a0b84f394b1b19e.tar.gz |
Added back old LARGEFILE handling
Fixed reference to freed memory in acl_init()/grant_init()
Fixed possible memory leak. (Could only happen in very strange circumstances)
Fixed bug in ALTER TABLE with BDB tables
Updated mysql-test for valgrind
Docs/manual.texi:
ChangeLog
acinclude.m4:
Added back old LARGEFILE handling.
(Needed to get MySQL to compile on Solaris 2.9 with gcc 3.x)
configure.in:
Added back old LARGEFILE handling.
(Needed to get MySQL to compile on Solaris 2.9 with gcc 3.x)
libmysqld/lib_sql.cc:
Fixed reference to freed memory
mysql-test/mysql-test-run.sh:
Added option --valgrind
mysys/Makefile.am:
Removed warning when doing make
sql/mysqld.cc:
Free regexp memory on shutdown.
read 'des' key files from data directory
Fixed reference to freed memory in grant_init()
sql/slave.cc:
Fixed wrong printf() argument
sql/sql_acl.cc:
Fixed reference to freed memory
sql/sql_acl.h:
Fixed reference to freed memory
sql/sql_base.cc:
Fixed possible memory leak. (Could only happen in very strange circumstances)
sql/sql_parse.cc:
Updated arguments to grant_reload()
sql/sql_table.cc:
Fixed bug in ALTER TABLE with BDB tables
sql/sql_yacc.yy:
memset -> bzero
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 867163be90d..3875e51a75a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -119,6 +119,7 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, SYNOPSIS acl_init() + thd Thread handler dont_read_acl_tables Set to 1 if run with --skip-grant RETURN VALUES @@ -127,9 +128,9 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, */ -my_bool acl_init(bool dont_read_acl_tables) +my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) { - THD *thd, *org_thd; + THD *thd; TABLE_LIST tables[3]; TABLE *table; READ_RECORD read_record_info; @@ -147,7 +148,6 @@ my_bool acl_init(bool dont_read_acl_tables) /* To be able to run this from boot, we allocate a temporary THD */ - org_thd=current_thd; // Save for restore if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: inspected */ thd->store_globals(); @@ -339,6 +339,11 @@ end: delete thd; if (org_thd) org_thd->store_globals(); /* purecov: inspected */ + else + { + /* Remember that we don't have a THD */ + my_pthread_setspecific_ptr(THR_THD, 0); + } DBUG_RETURN(return_val); } @@ -385,7 +390,7 @@ void acl_reload(THD *thd) delete_dynamic(&acl_wild_hosts); hash_free(&acl_check_hosts); - if (acl_init(0)) + if (acl_init(thd, 0)) { // Error. Revert to old list acl_free(); /* purecov: inspected */ acl_hosts=old_acl_hosts; @@ -2268,9 +2273,9 @@ void grant_free(void) /* Init grant array if possible */ -my_bool grant_init(void) +my_bool grant_init(THD *org_thd) { - THD *thd, *org_thd; + THD *thd; TABLE_LIST tables[2]; MYSQL_LOCK *lock; my_bool return_val= 1; @@ -2286,7 +2291,6 @@ my_bool grant_init(void) if (!initialized) DBUG_RETURN(0); /* purecov: tested */ - org_thd=current_thd; if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: deadcode */ thd->store_globals(); @@ -2344,13 +2348,18 @@ end: delete thd; if (org_thd) org_thd->store_globals(); + else + { + /* Remember that we don't have a THD */ + my_pthread_setspecific_ptr(THR_THD, 0); + } DBUG_RETURN(return_val); } /* Reload grant array if possible */ -void grant_reload(void) +void grant_reload(THD *thd) { HASH old_hash_tables;bool old_grant_option; MEM_ROOT old_mem; @@ -2364,7 +2373,7 @@ void grant_reload(void) old_grant_option = grant_option; old_mem = memex; - if (grant_init()) + if (grant_init(thd)) { // Error. Revert to old hash grant_free(); /* purecov: deadcode */ hash_tables=old_hash_tables; /* purecov: deadcode */ |