List:Commits« Previous MessageNext Message »
From:Magne Mahre Date:February 3 2011 10:13am
Subject:bzr commit into mysql-trunk branch (magne.mahre:3596) Bug#58915
View as plain text  
#At file:///export/home/tmp/x/mysql-trunk-58915/ based on revid:georgi.kodinov@stripped

 3596 Magne Mahre	2011-02-03
      Bug#58915 Valgrind warning in MYSQLparse()
      
      Under execution of a CHANGE MASTER command,
      a dynamic array (lex.bi.repl_ignore_server_ids)
      in the LEX replication information structure is
      allocated.
      
      Under normal operation, this array was deallocated
      at the end of execution (end of change_master() ).
      Certain error conditions (most notable if the 
      client thread is killed) would abort the execution
      before change_master() is called, resulting in
      memory block being lost.
      
      The deallocation has been moved to 
      THD::cleanup_after_query() to ensure that correct
      deallocation happens in all situations.
     @ sql/rpl_slave.cc
        Moved deallocation to THD::cleanup_after_query
     @ sql/sql_class.cc
        Moved cleanup code here (from change_master())
     @ sql/sql_lex.cc
        Initialize replication information structure
        to a known (0) value.

    modified:
      sql/rpl_slave.cc
      sql/sql_class.cc
      sql/sql_lex.cc
      sql/sql_yacc.yy
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-01-24 03:58:22 +0000
+++ b/sql/rpl_slave.cc	2011-02-03 10:13:06 +0000
@@ -10,8 +10,8 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   along with this program; if not, write to the Free Software Foundation,
+   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA */
 
 
 /**
@@ -6126,7 +6126,6 @@ err:
   thd_proc_info(thd, 0);
   if (ret == FALSE)
     my_ok(thd);
-  delete_dynamic(&lex_mi->repl_ignore_server_ids); //freeing of parser-time alloc
   DBUG_RETURN(ret);
 }
 

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2011-02-02 09:04:55 +0000
+++ b/sql/sql_class.cc	2011-02-03 10:13:06 +0000
@@ -11,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software Foundation,
-   51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
 
 
 /*****************************************************************************
@@ -1458,6 +1458,11 @@ void THD::cleanup_after_query()
   /* reset table map for multi-table update */
   table_map_for_update= 0;
   m_binlog_invoker= FALSE;
+  /* reset replication info structure */
+  if (lex && lex->mi.repl_ignore_server_ids.buffer) 
+  {
+    delete_dynamic(&lex->mi.repl_ignore_server_ids);
+  }
 }
 
 

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2011-01-26 07:37:18 +0000
+++ b/sql/sql_lex.cc	2011-02-03 10:13:06 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -10,8 +10,9 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+   along with this program; if not, write to the Free Software 
+   Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, 
+   MA 02110-1301 USA */
 
 
 /* A lexical scanner on a temporary buffer with a yacc interface */
@@ -2366,6 +2367,7 @@ LEX::LEX()
                          plugins_static_buffer,
                          INITIAL_LEX_PLUGIN_LIST_SIZE, 
                          INITIAL_LEX_PLUGIN_LIST_SIZE);
+  memset(&mi, 0, sizeof(LEX_MASTER_INFO));
   reset_query_tables_list(TRUE);
 }
 

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2011-01-10 12:45:53 +0000
+++ b/sql/sql_yacc.yy	2011-02-03 10:13:06 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11,7 +11,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 
+   MA 02110-1301  USA */
 
 /* sql_yacc.yy */
 
@@ -1874,7 +1875,7 @@ change:
             /*
               Clear LEX_MASTER_INFO struct and allocate memory for
               repl_ignore_server_ids. repl_ignore_server_ids is freed
-              at the end of change_master. So it is guaranteed to be
+              in THD::cleanup_after_query.  So it is guaranteed to be
               uninitialized before here.
             */
             lex->mi.set_unspecified();


Attachment: [text/bzr-bundle] bzr/magne.mahre@oracle.com-20110203101306-q8auashb3d7icxho.bundle
Thread
bzr commit into mysql-trunk branch (magne.mahre:3596) Bug#58915Magne Mahre3 Feb