diff options
author | unknown <holyfoot@deer.(none)> | 2006-06-01 17:06:42 +0500 |
---|---|---|
committer | unknown <holyfoot@deer.(none)> | 2006-06-01 17:06:42 +0500 |
commit | eadcf20081b18b28f344552a9902fea2404d55bd (patch) | |
tree | d38087a9ddc2cb5e7182d44fada846bcf265fc41 /libmysqld/libmysqld.c | |
parent | b29e052dbfe5021fefb5d312860a4980c851c24b (diff) | |
download | mariadb-git-eadcf20081b18b28f344552a9902fea2404d55bd.tar.gz |
bug #16017 (memory leaks in embedded server)
There actually was 3 different problems -
hash_user_connections wasn't cleaned
one strdupped database name wasn't freed
and stmt->mem_root wasn't cleaned as it was
replased with mysql->field_alloc for result
For the last one - i made the library using stmt's
fields to store result if it's the case.
include/mysql.h:
statement pointer added to the advanced_command to be checked in
embedded server
include/sql_common.h:
stmt added to the cli_advanced_command interface
libmysql/libmysql.c:
stmt pointer now sent to advanced_command
libmysqld/embedded_priv.h:
it's enough to send database name to check_embedded_connection
libmysqld/lib_sql.cc:
Now we store result directly in the MYSQL_STMT structure to
avoid extra copying
libmysqld/libmysqld.c:
it's enough to only send database pointer to check_embedded_connection
sql-common/client.c:
stmt fake attribute added to cli_advanced_command
sql/sql_parse.cc:
hash_user_connections isn't used if no access checks compiled
Diffstat (limited to 'libmysqld/libmysqld.c')
-rw-r--r-- | libmysqld/libmysqld.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 6fa41fb3fd0..5505049e0e0 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -134,7 +134,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,ulong client_flag) { - char *db_name; char name_buff[USERNAME_LENGTH]; DBUG_ENTER("mysql_real_connect"); @@ -197,13 +196,11 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, port=0; unix_socket=0; - db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL; + mysql->thd= create_embedded_thd(client_flag); - mysql->thd= create_embedded_thd(client_flag, db_name); + init_embedded_mysql(mysql, client_flag); - init_embedded_mysql(mysql, client_flag, db_name); - - if (check_embedded_connection(mysql)) + if (check_embedded_connection(mysql, db)) goto error; if (mysql_init_charset(mysql)) |