summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@sun.com>2010-06-23 08:13:34 +0200
committerTor Didriksen <tor.didriksen@sun.com>2010-06-23 08:13:34 +0200
commitec537a1ad1d5a328b0f76b0e99f10e782fa48f4d (patch)
treeff4adc659727033439acc82c9207a6e5b9e250cc /sql/sql_select.cc
parentef4c0f68d12ac8d86f57550599a1be24aa9c6bfe (diff)
downloadmariadb-git-ec537a1ad1d5a328b0f76b0e99f10e782fa48f4d.tar.gz
Backport of Bug#53236 Segfault in DTCollation::set(DTCollation&)
Don't call member functions for a NIL pointer. mysql-test/r/subselect4.result: Add test case. mysql-test/t/subselect4.test: Add test case. sql/sql_select.cc: If the (virtual) member function clone_item() returns NULL, there is no substitution to be made, and we don't need to set the collation. The test was invoking Item_cache::clone_item()
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index cf8f258d08d..d9b6bff0663 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8629,10 +8629,9 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
left_item->collation.collation == value->collation.collation))
{
Item *tmp=value->clone_item();
- tmp->collation.set(right_item->collation);
-
if (tmp)
{
+ tmp->collation.set(right_item->collation);
thd->change_item_tree(args + 1, tmp);
func->update_used_tables();
if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC)
@@ -8653,10 +8652,9 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
right_item->collation.collation == value->collation.collation))
{
Item *tmp= value->clone_item();
- tmp->collation.set(left_item->collation);
-
if (tmp)
{
+ tmp->collation.set(left_item->collation);
thd->change_item_tree(args, tmp);
value= tmp;
func->update_used_tables();