Commit 0868446b authored by hf@deer.(none)'s avatar hf@deer.(none)

SCRUM

embedded library
missed memory freeing added
parent cda32e12
...@@ -26,6 +26,7 @@ C_MODE_START ...@@ -26,6 +26,7 @@ C_MODE_START
extern void lib_connection_phase(NET *net, int phase); extern void lib_connection_phase(NET *net, int phase);
extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db); extern void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db);
extern void *create_embedded_thd(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; extern MYSQL_METHODS embedded_methods;
void free_old_query(MYSQL *mysql); void free_old_query(MYSQL *mysql);
extern my_bool server_inited; extern my_bool server_inited;
......
...@@ -474,6 +474,16 @@ void *create_embedded_thd(int client_flag, char *db) ...@@ -474,6 +474,16 @@ void *create_embedded_thd(int client_flag, char *db)
return thd; 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 C_MODE_END
bool Protocol::send_fields(List<Item> *list, uint flag) bool Protocol::send_fields(List<Item> *list, uint flag)
......
...@@ -289,6 +289,9 @@ void STDCALL mysql_close(MYSQL *mysql) ...@@ -289,6 +289,9 @@ void STDCALL mysql_close(MYSQL *mysql)
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
if (mysql->free_me) if (mysql->free_me)
my_free((gptr) mysql,MYF(0)); my_free((gptr) mysql,MYF(0));
free_embedded_thd(mysql);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment