Commit 87b8bf22 authored by unknown's avatar unknown

BUG#19318 valgrind: memory leak in ndb_mgmd

clean up after ConfigValuesFactory


ndb/include/util/ConfigValues.hpp:
  We now have a destructor
ndb/src/common/util/ConfigValues.cpp:
  Free m_cfg on destruct (if we've set it).
  
  Also getConfigValues() instead of m_cfg
parent 2a138695
...@@ -96,6 +96,7 @@ public: ...@@ -96,6 +96,7 @@ public:
public: public:
ConfigValuesFactory(Uint32 keys = 50, Uint32 data = 10); // Initial ConfigValuesFactory(Uint32 keys = 50, Uint32 data = 10); // Initial
ConfigValuesFactory(ConfigValues * m_cfg); // ConfigValuesFactory(ConfigValues * m_cfg); //
~ConfigValuesFactory();
ConfigValues * m_cfg; ConfigValues * m_cfg;
ConfigValues * getConfigValues(); ConfigValues * getConfigValues();
......
...@@ -294,6 +294,12 @@ ConfigValuesFactory::ConfigValuesFactory(ConfigValues * cfg){ ...@@ -294,6 +294,12 @@ ConfigValuesFactory::ConfigValuesFactory(ConfigValues * cfg){
} }
} }
ConfigValuesFactory::~ConfigValuesFactory()
{
if(m_cfg)
free(m_cfg);
}
ConfigValues * ConfigValues *
ConfigValuesFactory::create(Uint32 keys, Uint32 data){ ConfigValuesFactory::create(Uint32 keys, Uint32 data){
Uint32 sz = sizeof(ConfigValues); Uint32 sz = sizeof(ConfigValues);
...@@ -528,7 +534,7 @@ ConfigValuesFactory::extractCurrentSection(const ConfigValues::ConstIterator & c ...@@ -528,7 +534,7 @@ ConfigValuesFactory::extractCurrentSection(const ConfigValues::ConstIterator & c
} }
} }
ConfigValues * ret = fac->m_cfg; ConfigValues * ret = fac->getConfigValues();
delete fac; delete fac;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment