Skip to content

Commit

Permalink
fix memory leak in RgbaInputFile constructor (#1221)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hillman <[email protected]>
  • Loading branch information
peterhillman authored Jan 19, 2022
1 parent 434776b commit aeaf98f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/lib/OpenEXR/ImfRgbaFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,12 +1174,13 @@ RgbaInputFile::RgbaInputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is,

RgbaInputFile::RgbaInputFile (int partNumber, const char name[], int numThreads) :
_multiPartFile (new MultiPartInputFile (name, numThreads)),
_inputPart(new InputPart(*_multiPartFile,partNumber)),
_inputPart (nullptr),
_fromYca (nullptr),
_channelNamePrefix ("")
{
try
{
_inputPart = new InputPart(*_multiPartFile,partNumber);
RgbaChannels rgbaChannels = channels();
if (rgbaChannels & WRITE_C)
_fromYca = new FromYca (*_inputPart, rgbaChannels);
Expand All @@ -1200,12 +1201,13 @@ RgbaInputFile::RgbaInputFile (int partNumber, const char name[], int numThreads)

RgbaInputFile::RgbaInputFile (int partNumber, OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThreads) :
_multiPartFile (new MultiPartInputFile (is, numThreads)),
_inputPart(new InputPart(*_multiPartFile,partNumber)),
_inputPart(nullptr),
_fromYca (nullptr),
_channelNamePrefix ("")
{
try
{
_inputPart = new InputPart(*_multiPartFile,partNumber);
RgbaChannels rgbaChannels = channels();
if (rgbaChannels & WRITE_C)
_fromYca = new FromYca (*_inputPart, rgbaChannels);
Expand All @@ -1229,12 +1231,13 @@ RgbaInputFile::RgbaInputFile (int partNumber,
int numThreads)
:
_multiPartFile (new MultiPartInputFile (name, numThreads)),
_inputPart( new InputPart(*_multiPartFile,partNumber)),
_fromYca (0),
_channelNamePrefix (prefixFromLayerName (layerName, _inputPart->header()))
_inputPart (nullptr),
_fromYca (0)
{
try
{
_inputPart = new InputPart(*_multiPartFile,partNumber);
_channelNamePrefix = prefixFromLayerName (layerName, _inputPart->header());
RgbaChannels rgbaChannels = channels();

if (rgbaChannels & WRITE_C)
Expand All @@ -1258,12 +1261,13 @@ RgbaInputFile::RgbaInputFile (int partNumber,
int numThreads)
:
_multiPartFile (new MultiPartInputFile (is, numThreads)),
_inputPart( new InputPart(*_multiPartFile,partNumber)),
_fromYca (0),
_channelNamePrefix (prefixFromLayerName (layerName, _inputPart->header()))
_inputPart(nullptr),
_fromYca (0)
{
try
{
_inputPart = new InputPart(*_multiPartFile,partNumber);
_channelNamePrefix = prefixFromLayerName (layerName, _inputPart->header());
RgbaChannels rgbaChannels = channels();

if (rgbaChannels & WRITE_C)
Expand Down

0 comments on commit aeaf98f

Please sign in to comment.