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).
This commit is contained in:
Marko Mäkelä 2019-10-04 10:27:55 +03:00
parent eb0a10b072
commit 5709a7777b

View File

@ -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());