mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 05:37:21 -05:00
#13883 HDF5Exporter: Initialize m_hdfFile to nullptr to fix crash on exception
Uninitialized m_hdfFile caused a crash when the H5::H5File constructor threw an exception, as the catch block called delete on a garbage pointer.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifHdf5Exporter::RifHdf5Exporter( const std::string& fileName )
|
||||
: m_fileName( fileName )
|
||||
, m_hdfFile( nullptr )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -31,8 +32,6 @@ RifHdf5Exporter::RifHdf5Exporter( const std::string& fileName )
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
delete m_hdfFile;
|
||||
m_hdfFile = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user