List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:March 24 2010 2:38pm
Subject:bzr commit into mysql-5.1-bugteam branch (Sergey.Glukhov:3415)
Bug#52124
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.1-bug-52177/ based on revid:sergey.glukhov@stripped

 3415 Sergey Glukhov	2010-03-24
      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 its
      destruction. It leads to memory leaks.
      The fix is to delete 'comparators' array in destructor.
     @ mysql-test/r/row.result
        test result
     @ mysql-test/t/row.test
        test case
     @ sql/item_cmpfunc.h
        added Arg_comparator which frees 'comparators' array

    modified:
      mysql-test/r/row.result
      mysql-test/t/row.test
      sql/item_cmpfunc.h
=== modified file 'mysql-test/r/row.result'
--- a/mysql-test/r/row.result	2009-02-19 13:59:00 +0000
+++ b/mysql-test/r/row.result	2010-03-24 14:38:32 +0000
@@ -457,3 +457,17 @@ abc	1	abc	1
 select host,user from mysql.user where (host,user) = ('localhost','test');
 host	user
 drop table t1,t2;
+#
+# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+#
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (),();
+Warnings:
+Warning	1364	Field 'a' doesn't have a default value
+SELECT 1 FROM t1 WHERE ROW(a, b) >=
+ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
+1
+Warnings:
+Warning	1292	Incorrect datetime value: '1234' for column 'a' at row 1
+Warning	1292	Incorrect datetime value: '1' for column 'a' at row 2
+DROP TABLE t1;

=== modified file 'mysql-test/t/row.test'
--- a/mysql-test/t/row.test	2009-02-19 13:20:44 +0000
+++ b/mysql-test/t/row.test	2010-03-24 14:38:32 +0000
@@ -255,3 +255,12 @@ select * from t1,t2 where (a,b) = (c,d);
 
 select host,user from mysql.user where (host,user) = ('localhost','test');
 drop table t1,t2;
+
+--echo #
+--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (),();
+SELECT 1 FROM t1 WHERE ROW(a, b) >=
+ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
+DROP TABLE t1;

=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h	2010-03-14 16:01:45 +0000
+++ b/sql/item_cmpfunc.h	2010-03-24 14:38:32 +0000
@@ -54,12 +54,19 @@ 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) {};
 
+
+  ~Arg_comparator()
+  {
+    if (comparators)
+      delete [] comparators;
+  }
+
   int set_compare_func(Item_result_field *owner, Item_result type);
   inline int set_compare_func(Item_result_field *owner_arg)
   {


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@sun.com-20100324143832-4ofe4goa1pr6y5ix.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Sergey.Glukhov:3415)Bug#52124Sergey Glukhov24 Mar