List:Commits« Previous MessageNext Message »
From:John David Duncan Date:November 7 2011 7:18am
Subject:bzr push into mysql-5.5-cluster branch (john.duncan:3626 to 3627)
View as plain text  
 3627 John David Duncan	2011-11-06
      Initialization problem with TableSpec; make sure the must_free flags are all initialized to zero.

    modified:
      storage/ndb/memcache/include/TableSpec.h
      storage/ndb/memcache/src/TableSpec.cc
 3626 John David Duncan	2011-11-06
      Fix for memory leaks in Record and in Config_v1 configuration reader.

    modified:
      storage/ndb/memcache/include/Record.h
      storage/ndb/memcache/include/TableSpec.h
      storage/ndb/memcache/src/Config_v1.cc
      storage/ndb/memcache/src/Record.cc
      storage/ndb/memcache/src/TableSpec.cc
=== modified file 'storage/ndb/memcache/include/TableSpec.h'
--- a/storage/ndb/memcache/include/TableSpec.h	2011-11-07 02:05:20 +0000
+++ b/storage/ndb/memcache/include/TableSpec.h	2011-11-07 07:07:43 +0000
@@ -69,7 +69,10 @@ class TableSpec {
     unsigned all_val_cols : 1;
     unsigned special_cols : 1;   
   } must_free;
-    
+
+  /* private instance methods */
+  void initialize_flags(void);
+
   /* private class methods */
   static int build_column_list(const char ** const &array, const char *list);  
 };

=== modified file 'storage/ndb/memcache/src/TableSpec.cc'
--- a/storage/ndb/memcache/src/TableSpec.cc	2011-11-07 02:05:20 +0000
+++ b/storage/ndb/memcache/src/TableSpec.cc	2011-11-07 07:07:43 +0000
@@ -74,6 +74,18 @@ int TableSpec::build_column_list(const c
 }
 
 
+void TableSpec::initialize_flags() {
+  must_free.none         = 0;
+  must_free.schema_name  = 0;
+  must_free.table_name   = 0;
+  must_free.first_key    = 0;
+  must_free.all_key_cols = 0;
+  must_free.first_val    = 0;
+  must_free.all_val_cols = 0;
+  must_free.special_cols = 0;
+}
+
+
 /* This constructor takes comma-separated lists of key-columns and value columns
 */
 TableSpec::TableSpec(const char *sqltable,
@@ -83,6 +95,8 @@ TableSpec::TableSpec(const char *sqltabl
   key_columns(new const char *[MAX_KEY_COLUMNS]) ,
   value_columns(new const char *[MAX_VAL_COLUMNS]) 
 {
+  initialize_flags();
+  
   nkeycols = build_column_list(key_columns, keycols);
   if(nkeycols) must_free.first_key = 1;
   
@@ -100,8 +114,6 @@ TableSpec::TableSpec(const char *sqltabl
       *s = '\0' ;
       table_name = s+1;
     }
-    must_free.none = 0;
-    must_free.table_name = must_free.all_val_cols = must_free.special_cols = 0;
   }
 }
 
@@ -116,6 +128,8 @@ TableSpec::TableSpec(const TableSpec &t)
   key_columns(new const char *[t.nkeycols]) ,
   value_columns(new const char *[t.nvaluecols])
 { 
+   initialize_flags();
+   
    must_free.schema_name = must_free.table_name = 1;
    must_free.special_cols = 1;
    if(nkeycols) {
@@ -128,7 +142,6 @@ TableSpec::TableSpec(const TableSpec &t)
        value_columns[i] = strdup(t.value_columns[i]);
      must_free.all_val_cols = 1;
   }
-  must_free.first_key = must_free.first_val = 0;
 }
 
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (john.duncan:3626 to 3627) John David Duncan7 Nov