summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-04-30 03:14:42 +0300
committerunknown <monty@mysql.com>2005-04-30 03:14:42 +0300
commitac82a2d5eb0f183b27ddc3417b3b33899ef17bf5 (patch)
tree0f9fb389faa0f7571636772439feae0aabc53252 /sql/unireg.cc
parent8b5b3652eca26b08a95548582d79952c4f8d59b1 (diff)
downloadmariadb-git-ac82a2d5eb0f183b27ddc3417b3b33899ef17bf5.tar.gz
Setting a variable to CAST(NULL as X) set the result type of the variable to X. (Bug #6598)
mysql-test/r/bigint.result: Test to show show that the parser threats big longlong values as unsigned mysql-test/r/user_var.result: Test of CAST(NULL as SIGNED/UNSIGNED) mysql-test/t/bigint.test: Test to show show that the parser threats big longlong values as unsigned mysql-test/t/user_var.test: Test of CAST(NULL as SIGNED/UNSIGNED) sql/item_func.cc: Setting a variable to CAST(NULL as X) set the result type of the variable to X. (Bug #6598) Setting a variable to NULL doesn't change the old result type. sql/item_func.h: Detect setting a variable to NULL sql/unireg.cc: Safety fix
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 929ca5c672e..95a383e0f01 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -685,6 +685,9 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong default values
while ((field=it++))
{
+ /*
+ regfield don't have to be deleted as it's allocated with sql_alloc()
+ */
Field *regfield=make_field((char*) buff+field->offset,field->length,
null_pos,
null_count & 7,
@@ -696,7 +699,8 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
field->interval,
field->field_name,
&table);
- DBUG_ASSERT(regfield);
+ if (!regfield)
+ goto err; // End of memory
if (!(field->flags & NOT_NULL_FLAG))
null_count++;
@@ -730,7 +734,6 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
regfield->store(ER(ER_NO), (uint) strlen(ER(ER_NO)),system_charset_info);
else
regfield->reset();
- delete regfield;
}
/* Fill not used startpos */