#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 committed 2026-04-29 13:20:00 +02:00
1 parent 098f2e5f05
commit 7fe4b38054
1 file changed
+1 -2
@@ -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;
}
}