Skip to content

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

Merged
hjmjohnson merged 1 commit into
masterfrom
pr/fix-add-exts-leak
Nov 5, 2026
Merged

hjmjohnson merged 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.

@hjmjohnson
hjmjohnson marked this pull request as ready for review September 24, 2026 12:17
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)
@hjmjohnson
hjmjohnson force-pushed the pr/fix-add-exts-leak branch from c2d916c to 07a259f Compare October 6, 2026 14:35
@hjmjohnson
hjmjohnson merged commit 056478e into master Nov 5, 2026
4 checks passed
@hjmjohnson
hjmjohnson deleted the pr/fix-add-exts-leak branch November 5, 2026 19:44
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