From 2a33b0514ee0dfb313bdb53551edc7df20ac1a05 Mon Sep 17 00:00:00 2001 From: "bell@sanja.is.com.ua" <> Date: Tue, 1 Jul 2003 19:05:08 +0300 Subject: [PATCH] fixed uninitialized pointer --- sql/mysqld.cc | 7 ++++++- sql/sql_parse.cc | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 27fc8ea70ac..0ea6b0778d5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1821,7 +1821,12 @@ extern "C" int my_message_sql(uint error, const char *str, DBUG_PRINT("error", ("Message: '%s'", str)); if ((thd= current_thd)) { - if (thd->lex.current_select->no_error && !thd->is_fatal_error) + /* + thd->lex.current_select equel to zero if lex structure is not inited + (not query command (COM_QUERY)) + */ + if (thd->lex.current_select && + thd->lex.current_select->no_error && !thd->is_fatal_error) { DBUG_PRINT("error", ("above error converted to warning")); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5070466007e..6ebb338f872 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1057,6 +1057,11 @@ bool do_command(THD *thd) net= &thd->net; thd->current_tablenr=0; + /* + indicator of uninitialized lex => normal flow of errors handling + (see my_message_sql) + */ + thd->lex.current_select= 0; packet=0; old_timeout=net->read_timeout;