diff options
author | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-03-05 11:35:04 +0400 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-03-05 11:35:04 +0400 |
commit | 5c2d49dbedd4aff65d3459ae6648b21a3d1727b3 (patch) | |
tree | 9c81b32745306c228b6fdf3b6e0c212739bd9d3d /libmysqld | |
parent | fd76e1489394c44513ef646246f50c12fdf1b0a0 (diff) | |
download | mariadb-git-5c2d49dbedd4aff65d3459ae6648b21a3d1727b3.tar.gz |
bug #25492 (Invalid deallocation in mysql_stmt_fetch())
Additional patch.
mysql_flush_use_result() fixed.
libmysqld/lib_sql.cc:
now emb_flush_use_result() uses emb_free_rows()
duplicating code removed
Diffstat (limited to 'libmysqld')
-rw-r--r-- | libmysqld/lib_sql.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 8992bea943b..9ee8d48eec4 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -69,10 +69,14 @@ void embedded_get_error(MYSQL *mysql) static void emb_free_rows(THD *thd) { + if (!thd->data) + return; + if (thd->current_stmt) free_root(&thd->data->alloc,MYF(0)); else free_rows(thd->data); + thd->data= NULL; } @@ -86,11 +90,8 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, THD *thd=(THD *) mysql->thd; NET *net= &mysql->net; - if (thd->data) - { - emb_free_rows(thd); - thd->data= 0; - } + emb_free_rows(thd); + /* Check that we are calling the client functions in right order */ if (mysql->status != MYSQL_STATUS_READY) { @@ -143,13 +144,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, static void emb_flush_use_result(MYSQL *mysql) { - MYSQL_DATA *data= ((THD*)(mysql->thd))->data; - - if (data) - { - free_rows(data); - ((THD*)(mysql->thd))->data= NULL; - } + emb_free_rows((THD*) (mysql->thd)); } static MYSQL_DATA * @@ -304,8 +299,7 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row) static void emb_free_embedded_thd(MYSQL *mysql) { THD *thd= (THD*)mysql->thd; - if (thd->data) - emb_free_rows(thd); + emb_free_rows(thd); thread_count--; delete thd; mysql->thd=0; |