Commit aa70ca71 authored by Tor Didriksen's avatar Tor Didriksen

backport of:

        ------------------------------------------------------------
        revno: 2617.81.1
        revision-id: tor.didriksen@sun.com-20090924061133-qo02zotz3yypmfpk
        parent: davi.arnaut@sun.com-20090923203724-tvz7x8dauzp686v7
        committer: Tor Didriksen <tor.didriksen@sun.com>
        branch nick: 6.0-codebase-bf-opt
        timestamp: Thu 2009-09-24 08:11:33 +0200
        message:
          Bug#47511 Segmentation fault during cleanup in sql_union (events_bugs.test)
          


sql/sql_lex.h:
  Ensure that fields used during cleanup() are always initialized by constructors.
parent 8a66b18c
...@@ -403,6 +403,8 @@ class Index_hint : public Sql_alloc ...@@ -403,6 +403,8 @@ class Index_hint : public Sql_alloc
struct LEX; struct LEX;
class st_select_lex; class st_select_lex;
class st_select_lex_unit; class st_select_lex_unit;
class st_select_lex_node { class st_select_lex_node {
protected: protected:
st_select_lex_node *next, **prev, /* neighbor list */ st_select_lex_node *next, **prev, /* neighbor list */
...@@ -440,8 +442,17 @@ class st_select_lex_node { ...@@ -440,8 +442,17 @@ class st_select_lex_node {
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr, MEM_ROOT *mem_root) {} static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {}
// Ensures that at least all members used during cleanup() are initialized.
st_select_lex_node()
: next(NULL), prev(NULL),
master(NULL), slave(NULL),
link_next(NULL), link_prev(NULL),
linkage(UNSPECIFIED_TYPE)
{
}
virtual ~st_select_lex_node() {} virtual ~st_select_lex_node() {}
inline st_select_lex_node* get_master() { return master; } inline st_select_lex_node* get_master() { return master; }
virtual void init_query(); virtual void init_query();
virtual void init_select(); virtual void init_select();
...@@ -487,6 +498,8 @@ class select_result; ...@@ -487,6 +498,8 @@ class select_result;
class JOIN; class JOIN;
class select_union; class select_union;
class Procedure; class Procedure;
class st_select_lex_unit: public st_select_lex_node { class st_select_lex_unit: public st_select_lex_node {
protected: protected:
TABLE_LIST result_table_list; TABLE_LIST result_table_list;
...@@ -498,6 +511,14 @@ class st_select_lex_unit: public st_select_lex_node { ...@@ -498,6 +511,14 @@ class st_select_lex_unit: public st_select_lex_node {
bool saved_error; bool saved_error;
public: public:
// Ensures that at least all members used during cleanup() are initialized.
st_select_lex_unit()
: union_result(NULL), table(NULL), result(NULL),
cleaned(false),
fake_select_lex(NULL)
{
}
bool prepared, // prepare phase already performed for UNION (unit) bool prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit) optimized, // optimize phase already performed for UNION (unit)
executed, // already executed executed, // already executed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment