summaryrefslogtreecommitdiff
path: root/sql/item_subselect.h
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2016-07-29 18:21:08 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2016-07-30 20:13:03 +0200
commit5fdb3cfcd432b85dc305a1a61c2d018a798a6ac3 (patch)
treef13bb287d1db1aed667ed48a226f74c97462e3d5 /sql/item_subselect.h
parentc6aaa2adbefa04463bb9b67264c09a04b9c4bfcd (diff)
downloadmariadb-git-5fdb3cfcd432b85dc305a1a61c2d018a798a6ac3.tar.gz
MDEV-10419: crash in mariadb 10.1.16-MariaDB-1~trusty
Fixed initialization and usage of THD reference in subselect engines.
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r--sql/item_subselect.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 0abfe0d5abc..a44503b4471 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -716,7 +716,8 @@ public:
ROWID_MERGE_ENGINE, TABLE_SCAN_ENGINE};
subselect_engine(Item_subselect *si,
- select_result_interceptor *res)
+ select_result_interceptor *res):
+ thd(NULL)
{
result= res;
item= si;
@@ -732,7 +733,7 @@ public:
Should be called before prepare().
*/
void set_thd(THD *thd_arg);
- THD * get_thd() { return thd; }
+ THD * get_thd() { return thd ? thd : current_thd; }
virtual int prepare(THD *)= 0;
virtual void fix_length_and_dec(Item_cache** row)= 0;
/*