Commit f2ebd039 authored by unknown's avatar unknown

fixed memory leak in ROW code (SCRUM 577)


sql/item_cmpfunc.cc:
  fixed memory leak in ROW code
sql/item_cmpfunc.h:
  fixed memory leak in ROW code
parent d7db6bee
...@@ -1078,8 +1078,9 @@ in_string::in_string(uint elements,qsort_cmp cmp_func) ...@@ -1078,8 +1078,9 @@ in_string::in_string(uint elements,qsort_cmp cmp_func)
in_string::~in_string() in_string::~in_string()
{ {
for (uint i=0 ; i < count ; i++) if (base)
((String*) base)[i].free(); for (uint i=0 ; i < count ; i++)
((String*) base)[i].free();
} }
void in_string::set(uint pos,Item *item) void in_string::set(uint pos,Item *item)
...@@ -1100,12 +1101,20 @@ byte *in_string::get_value(Item *item) ...@@ -1100,12 +1101,20 @@ byte *in_string::get_value(Item *item)
in_row::in_row(uint elements, Item * item) in_row::in_row(uint elements, Item * item)
{ {
DBUG_ENTER("in_row::in_row"); base= (char*) new cmp_item_row[count= elements];
base= (char*) new cmp_item_row[elements];
size= sizeof(cmp_item_row); size= sizeof(cmp_item_row);
compare= (qsort_cmp) cmp_row; compare= (qsort_cmp) cmp_row;
tmp.store_value(item); tmp.store_value(item);
DBUG_VOID_RETURN; }
in_row::~in_row()
{
if (base)
{
cmp_item_row *arr= (cmp_item_row *) base;
for (uint i=0 ; i < count ; i++)
arr[i].~cmp_item_row();
}
} }
byte *in_row::get_value(Item *item) byte *in_row::get_value(Item *item)
......
...@@ -557,6 +557,7 @@ class in_row :public in_vector ...@@ -557,6 +557,7 @@ class in_row :public in_vector
cmp_item_row tmp; cmp_item_row tmp;
public: public:
in_row(uint elements, Item *); in_row(uint elements, Item *);
~in_row();
void set(uint pos,Item *item); void set(uint pos,Item *item);
byte *get_value(Item *item); byte *get_value(Item *item);
}; };
......
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