diff options
author | holyfoot@deer.(none) <> | 2006-06-01 17:06:42 +0500 |
---|---|---|
committer | holyfoot@deer.(none) <> | 2006-06-01 17:06:42 +0500 |
commit | bc35c50063a28afeb6c70c22607a76088a1f10cb (patch) | |
tree | d38087a9ddc2cb5e7182d44fada846bcf265fc41 /include | |
parent | cb4c6a0dede7873aa151042b5f0aff9f545a5a89 (diff) | |
download | mariadb-git-bc35c50063a28afeb6c70c22607a76088a1f10cb.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.
Diffstat (limited to 'include')
-rw-r--r-- | include/mysql.h | 17 | ||||
-rw-r--r-- | include/sql_common.h | 3 |
2 files changed, 16 insertions, 4 deletions
diff --git a/include/mysql.h b/include/mysql.h index 0949937814c..143f6752c46 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -216,6 +216,7 @@ enum mysql_rpl_type }; struct st_mysql_methods; +struct st_mysql_stmt; typedef struct st_mysql { @@ -269,6 +270,12 @@ typedef struct st_mysql from mysql_stmt_close if close had to cancel result set of this object. */ my_bool *unbuffered_fetch_owner; + /* + In embedded server it points to the statement that is processed + in the current query. We store some results directly in statement + fields then. + */ + struct st_mysql_stmt *current_stmt; } MYSQL; typedef struct st_mysql_res { @@ -636,7 +643,8 @@ typedef struct st_mysql_methods unsigned long header_length, const char *arg, unsigned long arg_length, - my_bool skip_check); + my_bool skip_check, + MYSQL_STMT *stmt); MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, unsigned int fields); MYSQL_RES * (*use_result)(MYSQL *mysql); @@ -724,8 +732,11 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); */ #define simple_command(mysql, command, arg, length, skip_check) \ - (*(mysql)->methods->advanced_command)(mysql, command, \ - NullS, 0, arg, length, skip_check) + (*(mysql)->methods->advanced_command)(mysql, command, NullS, \ + 0, arg, length, skip_check, NULL) +#define stmt_command(mysql, command, arg, length, stmt) \ + (*(mysql)->methods->advanced_command)(mysql, command, NullS, \ + 0, arg, length, 1, stmt) unsigned long net_safe_read(MYSQL* mysql); #ifdef __NETWARE__ diff --git a/include/sql_common.h b/include/sql_common.h index c07a4a831bb..52d766d77d2 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -33,7 +33,8 @@ void mysql_read_default_options(struct st_mysql_options *options, my_bool cli_advanced_command(MYSQL *mysql, enum enum_server_command command, const char *header, ulong header_length, - const char *arg, ulong arg_length, my_bool skip_check); + const char *arg, ulong arg_length, my_bool skip_check, + MYSQL_STMT *stmt); void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode, const char *sqlstate); |