folding in internal ILM changes - conditional delete in exception catch block.
@@ -678,9 +678,16 @@ OutputFile::OutputFile
catch (IEX_NAMESPACE::BaseExc &e)
{
// ~OutputFile will not run, so free memory here
+ if (_data)
+ {
+ if (_data->_streamData)
+ {
delete _data->_streamData->os;
delete _data->_streamData;
+ }
+
delete _data;
+ }
REPLACE_EXC (e, "Cannot open image file "
"\"" << fileName << "\". " << e.what());
@@ -689,9 +696,15 @@ OutputFile::OutputFile
catch (...)
{
// ~OutputFile will not run, so free memory here
+ if (_data)
+ {
+ if (_data->_streamData)
+ {
delete _data->_streamData->os;
delete _data->_streamData;
+ }
delete _data;
+ }
throw;
}
@@ -725,8 +738,12 @@ OutputFile::OutputFile
catch (IEX_NAMESPACE::BaseExc &e)
{
// ~OutputFile will not run, so free memory here
+ if (_data)
+ {
+ if (_data->_streamData)
delete _data->_streamData;
delete _data;
+ }
REPLACE_EXC (e, "Cannot open image file "
"\"" << os.fileName() << "\". " << e.what());
@@ -735,8 +752,12 @@ OutputFile::OutputFile
catch (...)
{
// ~OutputFile will not run, so free memory here
+ if (_data)
+ {
+ if (_data->_streamData)
delete _data->_streamData;
delete _data;
+ }
throw;
}
