diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-04-16 16:42:34 +0500 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-04-16 16:42:34 +0500 |
commit | 649deaa8a1ab7660322152156b862a27de78d327 (patch) | |
tree | 474c979243c95c185ebce8f4157c5158e7b9870c /sql/item_cmpfunc.h | |
parent | 16fadb10b5d2a9328b5caa85963a3d851b35cef4 (diff) | |
download | mariadb-git-649deaa8a1ab7660322152156b862a27de78d327.tar.gz |
Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
Arg_comparator initializes 'comparators' array in case of
ROW comparison and does not free this array on destruction.
It leads to memory leaks.
The fix:
-added Arg_comparator::cleanup() method which frees
'comparators' array.
-added Item_bool_func2::cleanup() method which calls
Arg_comparator::cleanup() method
mysql-test/r/ps.result:
test case
mysql-test/r/row.result:
test case
mysql-test/t/ps.test:
test case
mysql-test/t/row.test:
test case
sql/item_cmpfunc.h:
-added Arg_comparator::cleanup() method which frees
'comparators' array.
-added Item_bool_func2::cleanup() method which calls
Arg_comparator::cleanup() method
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index f7d222a47d1..4eb27988984 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -54,9 +54,9 @@ public: /* Allow owner function to use string buffers. */ String value1, value2; - Arg_comparator(): thd(0), a_cache(0), b_cache(0), set_null(TRUE), + Arg_comparator(): comparators(0), thd(0), a_cache(0), b_cache(0), set_null(TRUE), get_value_a_func(0), get_value_b_func(0) {}; - Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0), + Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), comparators(0), thd(0), a_cache(0), b_cache(0), set_null(TRUE), get_value_a_func(0), get_value_b_func(0) {}; @@ -112,6 +112,11 @@ public: return (owner->type() == Item::FUNC_ITEM && ((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC); } + void cleanup() + { + delete [] comparators; + comparators= 0; + } friend class Item_func; }; @@ -365,6 +370,11 @@ public: CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; } uint decimal_precision() const { return 1; } void top_level_item() { abort_on_null= TRUE; } + void cleanup() + { + Item_int_func::cleanup(); + cmp.cleanup(); + } friend class Arg_comparator; }; |