summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-11-25 13:25:31 +0300
committerunknown <konstantin@mysql.com>2005-11-25 13:25:31 +0300
commit2a1ae3a5e3cbc7bb076c91ba0f8b5e6242319b28 (patch)
tree65b5b9174e08dc444e39d07dae9e09ef7a3facb9 /sql/table.cc
parent6fb8a4e915d8f2fabae9008bf3072e290eec03c4 (diff)
downloadmariadb-git-2a1ae3a5e3cbc7bb076c91ba0f8b5e6242319b28.tar.gz
A fix and a test case for Bug#14410 "Crash in Enum or Set type in
CREATE TABLE and PS/SP": make sure that 'typelib' object for ENUM values and 'Item_string' object for DEFAULT clause are created in the statement memory root. mysql-test/r/ps.result: Test results has been fixed (Bug#14410) mysql-test/t/ps.test: A test case for Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP" sql/mysql_priv.h: typelib() function declaration has been changed. sql/sql_table.cc: Supply the statement memory root to use in typelib() and safe_charset_converter() functions to ensure that objects created during the first execution of CREATE TABLE statement are allocated in persistent memory of the statement. sql/table.cc: Change typelib() function to require MEM_ROOT.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 04d1a95cd9b..de539205ffd 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1099,15 +1099,15 @@ fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types,
} /* fix_type_pointers */
-TYPELIB *typelib(List<String> &strings)
+TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings)
{
- TYPELIB *result=(TYPELIB*) sql_alloc(sizeof(TYPELIB));
+ TYPELIB *result= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB));
if (!result)
return 0;
result->count=strings.elements;
result->name="";
uint nbytes= (sizeof(char*) + sizeof(uint)) * (result->count + 1);
- if (!(result->type_names= (const char**) sql_alloc(nbytes)))
+ if (!(result->type_names= (const char**) alloc_root(mem_root, nbytes)))
return 0;
result->type_lengths= (uint*) (result->type_names + result->count + 1);
List_iterator<String> it(strings);