diff options
author | monty@mysql.com <> | 2003-12-11 06:24:08 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2003-12-11 06:24:08 +0200 |
commit | 7e92336b1da07c6424f3bdffcc5d3edf268268fa (patch) | |
tree | 1122f20a76a6996599a4c136c6be17aecb8f8bf6 /libmysql | |
parent | 34d0a16476e0db669bbe7cd9e56bb1d55ac1f18d (diff) | |
download | mariadb-git-7e92336b1da07c6424f3bdffcc5d3edf268268fa.tar.gz |
Fixed a possible memory leak on MacOSX when using the shared libmysql.so library (Bug #2061)
mysql_server_init() now returns error code if something went wrong (Bug #2062)
Don't use my_fopen() when reading symlink information as this may cause problems when a lot of files are opened.
Free thread keys with pthread_key_delete() instead of relying on automatic free. (Bug #2062)
Fixed bug in UNION statement with alias '*'. (Bug #1249)
Fixed a bug in DELETE ... ORDER BY ... LIMIT where the rows where not deleted in the proper order. (Bug #1024).
FOUND_ROWS() could return incorrect number of rows after a query with an impossible WHERE condition.
HOW DATABASES doesn't anymore show .sym files (on windows) that doesn't point to a valid directory. (Bug #1385)
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/libmysql.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 5fcc3ba5ee0..607d8af6e50 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -102,8 +102,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), char **argv __attribute__((unused)), char **groups __attribute__((unused))) { - mysql_once_init(); - return 0; + return (int) mysql_once_init(); } void STDCALL mysql_server_end() @@ -1436,7 +1435,8 @@ STDCALL mysql_rpl_query_type(const char* q, int len) MYSQL * STDCALL mysql_init(MYSQL *mysql) { - mysql_once_init(); + if (mysql_once_init()) + return 0; if (!mysql) { if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL)))) @@ -1476,15 +1476,20 @@ mysql_init(MYSQL *mysql) This function is called by mysql_init() and indirectly called by mysql_query(), so one should never have to call this from an outside program. + + RETURN + 0 ok + 1 could not initialize environment (out of memory or thread keys) */ -void mysql_once_init(void) +int mysql_once_init(void) { if (!mysql_client_init) { mysql_client_init=1; org_my_init_done=my_init_done; - my_init(); /* Will init threads */ + if (my_init()) /* Will init threads */ + return 1; init_client_errs(); if (!mysql_port) { @@ -1518,10 +1523,15 @@ void mysql_once_init(void) } #ifdef THREAD else - my_thread_init(); /* Init if new thread */ + { + if (my_thread_init()) /* Init if new thread */ + return 1; + } #endif + return 0; } + /************************************************************************** Fill in SSL part of MYSQL structure and set 'use_ssl' flag. NB! Errors are not reported until you do mysql_real_connect. |