#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:
Magne Sjaastad
2026-04-16 16:43:36 +02:00
parent b0799247c8
commit 5c35592f3a
@@ -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;
}
}