Skip to content

fix(java/driver/jni): release AdbcError in RaiseAdbcException#4391

Open
lidavidm wants to merge 2 commits into
apache:mainfrom
lidavidm:jni-exception
Open

fix(java/driver/jni): release AdbcError in RaiseAdbcException#4391
lidavidm wants to merge 2 commits into
apache:mainfrom
lidavidm:jni-exception

Conversation

@lidavidm

@lidavidm lidavidm commented Jun 12, 2026

Copy link
Copy Markdown
Member

We were simply leaking any errors before.

We were simply leaking any errors before.

Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
@lidavidm lidavidm marked this pull request as ready for review June 12, 2026 07:14
@lidavidm lidavidm requested review from amoeba and Copilot June 12, 2026 07:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a native-memory leak in the Java JNI driver by ensuring AdbcError resources are released when raising Java-side exceptions from failed ADBC calls.

Changes:

  • Introduces an AdbcErrorGuard RAII helper to automatically release AdbcError resources.
  • Updates RaiseAdbcException to take a mutable AdbcError& and invoke error.release() before throwing.
  • Replaces many per-function AdbcError stack variables with a shared AdbcErrorGuard instance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread java/driver/jni/src/main/cpp/jni_wrapper.cc
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@amoeba amoeba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

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