Commit 84f2c9ef authored by camp's avatar camp

Fixed memory leaks and file handle leaks.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@13506 18c085ea-50e0-402c-830e-de6fd14e8384
parent 5698524f
......@@ -71,6 +71,10 @@ class ColorTableAttributes;
// Jeremy Meredith, Fri Feb 20 14:54:04 EST 2009
// Added some alpha support methods.
//
// David Camp, Thu Jan 13 11:03:52 PST 2011
// Added DeleteInstance function to delete global data. Helps with valgrind.
// It is inline because it will only be used if you define DEBUG_MEMORY_LEAKS.
//
// ****************************************************************************
class PIPELINE_API avtColorTables
......@@ -101,6 +105,13 @@ public:
bool ExportColorTable(const std::string &ctName,
std::string &message);
void ImportColorTables();
void DeleteInstance()
{
if(instance) delete instance;
instance = NULL;
}
protected:
avtColorTables();
~avtColorTables();
......
......@@ -465,6 +465,7 @@ avtGadgetFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
fprintf(stderr,"done creating\n");
#endif
if(vec_flag) delete [] vec_flag;
}
......
......@@ -259,6 +259,10 @@ NetworkManager::NetworkManager(void) : virtualDatabases()
// Hank Childs, Sat Aug 21 14:35:47 PDT 2010
// Rename DDF to DataBinning.
//
// David Camp, Thu Jan 13 11:15:00 PST 2011
// Added the call to DeleteInstance of the avtColorTables.
// Help debug memory leaks.
//
// ****************************************************************************
NetworkManager::~NetworkManager(void)
......@@ -277,6 +281,8 @@ NetworkManager::~NetworkManager(void)
delete databasePlugins;
delete operatorPlugins;
delete plotPlugins;
avtColorTables::Instance()->DeleteInstance();
}
// ****************************************************************************
......
......@@ -988,6 +988,9 @@ int VisItSetupEnvironment(void)
* Shelly Prevost, Wed Jan 25 08:50:44 PST 2006
* Added the guifile argument.
*
* David Camp, Thu Jan 13 11:15:00 PST 2011
* Close file if an error occurred.
*
*******************************************************************************/
int VisItInitializeSocketAndDumpSimFile(const char *name,
const char *comment,
......@@ -1020,10 +1023,16 @@ int VisItInitializeSocketAndDumpSimFile(const char *name,
atexit(RemoveSimFile);
if (!GetLocalhostName())
{
fclose(file);
return FALSE;
}
if (!StartListening())
{
fclose(file);
return FALSE;
}
fprintf(file, "host %s\n", localhost);
fprintf(file, "port %d\n", listenPort);
......
......@@ -1003,6 +1003,7 @@ Transition_Block(const TransitionOptions &options, ImageObject *image1, ImageObj
printf("Wrote %s\n", outputName);
}
delete [] order;
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