summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-12-19 19:16:26 +0100
committerunknown <monty@mysql.com>2003-12-19 19:16:26 +0100
commit7592a73658ff04ddbf09e4c9edfb1613323dc6e9 (patch)
tree4ecf43cb5ce4567b22a71d0df8726bf128c51d09 /sql/sql_delete.cc
parentbfe77e3398944bed4c919ba0c7477a4318d9f2cc (diff)
downloadmariadb-git-7592a73658ff04ddbf09e4c9edfb1613323dc6e9.tar.gz
Fixed memory overrun bug in DELETE ... ORDER BY
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 4ab0cfa20c1..d7db5569670 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -27,7 +27,7 @@
#include "ha_innodb.h"
#include "sql_select.h"
-int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
+int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
ha_rows limit, ulong options)
{
int error;
@@ -116,7 +116,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if (options & OPTION_QUICK)
(void) table->file->extra(HA_EXTRA_QUICK);
- if (order)
+ if (order && order->elements)
{
uint length;
SORT_FIELD *sortorder;
@@ -130,10 +130,10 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
- if (thd->lex.select_lex.setup_ref_array(thd, 0) ||
+ if (thd->lex.select_lex.setup_ref_array(thd, order->elements) ||
setup_order(thd, thd->lex.select_lex.ref_pointer_array, &tables,
- fields, all_fields, order) ||
- !(sortorder=make_unireg_sortorder(order, &length)) ||
+ fields, all_fields, (ORDER*) order->first) ||
+ !(sortorder=make_unireg_sortorder((ORDER*) order->first, &length)) ||
(table->sort.found_records = filesort(thd, table, sortorder, length,
select, HA_POS_ERROR,
&examined_rows))
@@ -613,7 +613,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
{
/* Probably InnoDB table */
table_list->lock_type= TL_WRITE;
- DBUG_RETURN(mysql_delete(thd, table_list, (COND*) 0, (ORDER*) 0,
+ DBUG_RETURN(mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
HA_POS_ERROR, 0));
}
if (lock_and_wait_for_table_name(thd, table_list))