Skip to content

[MINOR][VL] Fix throw-new anti-pattern in FileReaderIterator.cc#11620

Merged
marin-ma merged 1 commit intoapache:mainfrom
acvictor:acvictor/fixThrowNewAntiPattern
Feb 16, 2026
Merged

[MINOR][VL] Fix throw-new anti-pattern in FileReaderIterator.cc#11620
marin-ma merged 1 commit intoapache:mainfrom
acvictor:acvictor/fixThrowNewAntiPattern

Conversation

@acvictor
Copy link
Contributor

What changes are proposed in this pull request?

This PR replaces throw new GlutenException(...) with throw GlutenException(...) in FileReaderIterator::getInputIteratorFromFileReader. throw new will allocate the exception object on the heap, but standard catch blocks catch by reference (catch (const std::exception& e)), so the pointer will never freed causing a memory leak on the exception path.

How was this patch tested?

Existing tests

Was this patch authored or co-authored using generative AI tooling?

No

Throw exceptions by value, not by pointer. Using throw new heap-allocates
the exception object which will never be freed since catch blocks expect
to catch by reference, causing a memory leak on the exception path.
@github-actions github-actions bot added the VELOX label Feb 16, 2026
@acvictor
Copy link
Contributor Author

@marin-ma can you please review this PR? Thanks in advance!

Copy link
Contributor

@marin-ma marin-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@marin-ma marin-ma merged commit 63ce5cc into apache:main Feb 16, 2026
57 of 58 checks passed
@acvictor acvictor deleted the acvictor/fixThrowNewAntiPattern branch March 3, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants