diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-04 10:27:55 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-04 10:27:55 +0300 |
commit | 5709a7777bd2c5c27b0f535099439f13c251de03 (patch) | |
tree | cfe8c749279215691bdf10f25d1213c6057de9e9 /sql/sql_lex.cc | |
parent | eb0a10b07222b01d40dee24e61aac9502256481f (diff) | |
download | mariadb-git-5709a7777bd2c5c27b0f535099439f13c251de03.tar.gz |
MDEV-19956: Do not dereference an uninitialized pointer
LEX::parsed_select_expr_cont(): Replace a condition with an
assertion DBUG_ASSERT(!s2->next_select()), and always
initialize sel1=s2, because all subsequent code paths will
assign to sel1->first_nested.
This was flagged by GCC reporting -Wmaybe-uninitialized
for the statement last->link_neighbour(sel1).
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 826e7a6def0..6f9f2200a00 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -9114,9 +9114,8 @@ SELECT_LEX_UNIT *LEX::parsed_select_expr_cont(SELECT_LEX_UNIT *unit, enum sub_select_type unit_type, bool distinct, bool oracle) { - SELECT_LEX *sel1; - if (!s2->next_select()) - sel1= s2; + DBUG_ASSERT(!s2->next_select()); + SELECT_LEX *sel1= s2; SELECT_LEX *last= unit->pre_last_parse->next_select(); int cmp= oracle? 0 : cmp_unit_op(unit_type, last->get_linkage()); |