Skip to content

Commit

Permalink
BUG: fixed memory leak in Nifti IO
Browse files Browse the repository at this point in the history
There is the small regression (s. Valgrind build) after
63590b8
  • Loading branch information
issakomi authored and hjmjohnson committed Aug 12, 2022
1 parent 8f5e261 commit 87f8716
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Modules/IO/NIFTI/src/itkNiftiImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2310,12 +2310,11 @@ NiftiImageIO ::Write(const void * buffer)
this->m_NiftiImage->data = static_cast<void *>(nifti_buf);
const int nifti_write_status = nifti_image_write_status(this->m_NiftiImage);
this->m_NiftiImage->data = nullptr; // if left pointing to data buffer
delete[] nifti_buf;
if (nifti_write_status)
{
itkExceptionMacro(<< "ERROR: nifti library failed to write image" << this->GetFileName());
}

delete[] nifti_buf;
}
}

Expand Down

0 comments on commit 87f8716

Please sign in to comment.