diff options
author | unknown <hf@deer.(none)> | 2003-09-19 14:17:55 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2003-09-19 14:17:55 +0500 |
commit | 6e92247842c5244be35f98e6347e472bf0b7175d (patch) | |
tree | d7b5e23550a3b56c93fc4abe69bcccc92d92c10e | |
parent | 83e8881a5ad2a0fdfcb1ad06adca3614b6c7e0e4 (diff) | |
download | mariadb-git-6e92247842c5244be35f98e6347e472bf0b7175d.tar.gz |
SCRUM
embedded library
missed memory freeing added
libmysqld/embedded_priv.h:
declaration added
libmysqld/lib_sql.cc:
implementation added
libmysqld/libmysqld.c:
mysql->thd releasing
-rw-r--r-- | libmysqld/embedded_priv.h | 1 | ||||
-rw-r--r-- | libmysqld/lib_sql.cc | 10 | ||||
-rw-r--r-- | libmysqld/libmysqld.c | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/libmysqld/embedded_priv.h b/libmysqld/embedded_priv.h index 833cc1b1f80..75461bbfbe0 100644 --- a/libmysqld/embedded_priv.h +++ b/libmysqld/embedded_priv.h @@ -26,6 +26,7 @@ C_MODE_START extern void lib_connection_phase(NET *net, int phase); extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db); extern void *create_embedded_thd(int client_flag, char *db); +extern void free_embedded_thd(MYSQL *mysql); extern MYSQL_METHODS embedded_methods; void free_old_query(MYSQL *mysql); extern my_bool server_inited; diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 24ef3b76c0e..179bbaeec91 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -474,6 +474,16 @@ void *create_embedded_thd(int client_flag, char *db) return thd; } +void free_embedded_thd(MYSQL *mysql) +{ + THD *thd= (THD*)mysql->thd; + if (!thd) + return; + if (thd->data) + free_rows(thd->data); + delete thd; +} + C_MODE_END bool Protocol::send_fields(List<Item> *list, uint flag) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 4862800f0a2..ddde18c1918 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -289,6 +289,9 @@ void STDCALL mysql_close(MYSQL *mysql) #endif /* HAVE_OPENSSL */ if (mysql->free_me) my_free((gptr) mysql,MYF(0)); + + free_embedded_thd(mysql); + } DBUG_VOID_RETURN; } |