List:Internals« Previous MessageNext Message »
From:pekka Date:March 31 2005 4:22pm
Subject:bk commit into 5.0 tree (pekka:1.1847)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of pekka. When pekka does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1847 05/03/31 16:22:46 pekka@stripped +2 -0
  ndb - fix small memory leak

  ndb/src/mgmapi/mgmapi.cpp
    1.44 05/03/31 16:12:09 pekka@stripped +10 -2
    fix small memory leak

  ndb/include/util/Vector.hpp
    1.4 05/03/31 16:12:09 pekka@stripped +8 -0
    fix small memory leak

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	pekka
# Host:	tuna.ndb.mysql.com
# Root:	/orca/space/pekka/ndb/version/my50

--- 1.3/ndb/include/util/Vector.hpp	2004-05-11 22:34:10 +02:00
+++ 1.4/ndb/include/util/Vector.hpp	2005-03-31 16:12:09 +02:00
@@ -61,6 +61,10 @@
 template<class T>
 Vector<T>::~Vector(){
   delete[] m_items;
+  // safety for placement new usage
+  m_items = 0;
+  m_size = 0;
+  m_arraySize = 0;
 }
 
 template<class T>
@@ -174,6 +178,10 @@
 template<class T>
 MutexVector<T>::~MutexVector(){
   delete[] m_items;
+  // safety for placement new usage
+  m_items = 0;
+  m_size = 0;
+  m_arraySize = 0;
 }
 
 template<class T>

--- 1.43/ndb/src/mgmapi/mgmapi.cpp	2005-03-03 09:49:38 +01:00
+++ 1.44/ndb/src/mgmapi/mgmapi.cpp	2005-03-31 16:12:09 +02:00
@@ -144,6 +144,7 @@
 NdbMgmHandle
 ndb_mgm_create_handle()
 {
+  DBUG_ENTER("ndb_mgm_create_handle");
   NdbMgmHandle h     =
     (NdbMgmHandle)my_malloc(sizeof(ndb_mgm_handle),MYF(MY_WME));
   h->connected       = 0;
@@ -163,7 +164,8 @@
   h->logfile = 0;
 #endif
 
-  return h;
+  DBUG_PRINT("info", ("handle=0x%x", (UintPtr)h));
+  DBUG_RETURN(h);
 }
 
 extern "C"
@@ -171,10 +173,13 @@
 ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv)
 {
   DBUG_ENTER("ndb_mgm_set_connectstring");
+  DBUG_PRINT("info", ("handle=0x%x", (UintPtr)handle));
+  handle->cfg.~LocalConfig();
   new (&(handle->cfg)) LocalConfig;
   if (!handle->cfg.init(mgmsrv, 0) ||
       handle->cfg.ids.size() == 0)
   {
+    handle->cfg.~LocalConfig();
     new (&(handle->cfg)) LocalConfig;
     handle->cfg.init(0, 0); /* reset the LocalConfig */
     SET_ERROR(handle, NDB_MGM_ILLEGAL_CONNECT_STRING, "");
@@ -191,8 +196,10 @@
 void
 ndb_mgm_destroy_handle(NdbMgmHandle * handle)
 {
+  DBUG_ENTER("ndb_mgm_destroy_handle");
   if(!handle)
-    return;
+    DBUG_VOID_RETURN;
+  DBUG_PRINT("info", ("handle=0x%x", (UintPtr)(* handle)));
   /**
    * important! only disconnect if connected
    * other code relies on this
@@ -209,6 +216,7 @@
   (*handle)->cfg.~LocalConfig();
   my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR));
   * handle = 0;
+  DBUG_VOID_RETURN;
 }
 
 /*****************************************************************************
Thread
bk commit into 5.0 tree (pekka:1.1847)pekka31 Mar