Skip to content

BUG: Free the extension data when nifti_add_extension fails - #99

Open
hjmjohnson wants to merge 1 commit into
masterfrom
pr/fix-add-exts-leak
Open

hjmjohnson wants to merge 1 commit into
masterfrom
pr/fix-add-exts-leak

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Re-submission of #62, reverted from master on 2026-09-24 so it can be
reviewed before merging. Content is unchanged from the original.

Base: master. Independent: nothing has to land before it.

Commits
  • BUG: Free the extension data when nifti_add_extension fails

Ordering for all the re-submitted work is tracked in #84.

act_add_exts() in both nifti_tool and nifti1_tool reads the extension
data from a file into edata and, if nifti_add_extension() then fails,
returns without freeing it.  The success path a few lines below frees
it already.

Found by clang's static analyzer, on a path the test suite does not
reach.

(cherry picked from commit ab2d71c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants