summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.(none)>2004-09-06 10:46:23 +0000
committerunknown <tomas@poseidon.(none)>2004-09-06 10:46:23 +0000
commitc7e942a8ff90fe6100518361129209a7cd5ab48d (patch)
tree874de12f90ef63794c116b4bd05e7562e99b5c3b /ndb
parent9fd78ea3d360725213a414328bb45246608b5d19 (diff)
downloadmariadb-git-c7e942a8ff90fe6100518361129209a7cd5ab48d.tar.gz
added ndb_mgm_destroy_configuration call
fixed memory leak in object map fixed uninitialized value blobs_pending ndb/include/mgmapi/mgmapi.h: added ndb_mgm_destroy_configuration call ndb/src/mgmapi/mgmapi.cpp: added ndb_mgm_destroy_configuration call ndb/src/ndbapi/ObjectMap.hpp: fixed memory leak ndb/src/ndbapi/ndb_cluster_connection.cpp: added ndb_mgm_destroy_configuration call sql/ha_ndbcluster.cc: fixed uninitialized value blobs_pending
Diffstat (limited to 'ndb')
-rw-r--r--ndb/include/mgmapi/mgmapi.h3
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp8
-rw-r--r--ndb/src/ndbapi/ObjectMap.hpp5
-rw-r--r--ndb/src/ndbapi/ndb_cluster_connection.cpp2
4 files changed, 15 insertions, 3 deletions
diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h
index 123297b0d71..a745688561c 100644
--- a/ndb/include/mgmapi/mgmapi.h
+++ b/ndb/include/mgmapi/mgmapi.h
@@ -664,10 +664,11 @@ extern "C" {
* @param handle NDB management handle.
* @param version Version of configuration, 0 means latest
* @see MAKE_VERSION
- * @Note the caller must free the pointer returned.
+ * @Note the caller must call ndb_mgm_detroy_configuration
*/
struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle,
unsigned version);
+ void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *);
int ndb_mgm_alloc_nodeid(NdbMgmHandle handle,
unsigned version,
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index e78b0d41cf2..0f65d9425ae 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -1509,6 +1509,14 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) {
}
extern "C"
+void
+ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *cfg)
+{
+ if (cfg)
+ delete (ConfigValues *)cfg;
+}
+
+extern "C"
int
ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, unsigned *pnodeid, int nodetype)
{
diff --git a/ndb/src/ndbapi/ObjectMap.hpp b/ndb/src/ndbapi/ObjectMap.hpp
index f67774bb413..6c984c644e2 100644
--- a/ndb/src/ndbapi/ObjectMap.hpp
+++ b/ndb/src/ndbapi/ObjectMap.hpp
@@ -134,7 +134,10 @@ NdbObjectIdMap::expand(Uint32 incSize){
Uint32 newSize = m_size + incSize;
MapEntry * tmp = (MapEntry*)malloc(newSize * sizeof(MapEntry));
- memcpy(tmp, m_map, m_size * sizeof(MapEntry));
+ if (m_map) {
+ memcpy(tmp, m_map, m_size * sizeof(MapEntry));
+ free((void*)m_map);
+ }
m_map = tmp;
for(Uint32 i = m_size; i<newSize; i++){
diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp
index 9fb7a563807..24df793c0d2 100644
--- a/ndb/src/ndbapi/ndb_cluster_connection.cpp
+++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp
@@ -116,7 +116,7 @@ int Ndb_cluster_connection::connect(int reconnect)
if(props == 0)
break;
m_facade->start_instance(nodeId, props);
- free(props);
+ ndb_mgm_destroy_configuration(props);
m_facade->connected();
DBUG_RETURN(0);
} while(0);