Copilot commented on code in PR #4391:
URL: https://github.com/apache/arrow-adbc/pull/4391#discussion_r3401433728


##########
java/driver/jni/src/main/cpp/jni_wrapper.cc:
##########
@@ -35,6 +35,17 @@
 
 namespace {
 
+struct AdbcErrorGuard {
+  struct AdbcError error = ADBC_ERROR_INIT;
+
+  ~AdbcErrorGuard() {
+    if (error.release != nullptr) {
+      error.release(&error);
+      error.release = nullptr;
+    }
+  }
+};

Review Comment:
   AdbcErrorGuard is implicitly copyable/movable, which risks double-calling 
AdbcError::release (double-free) if the guard is ever accidentally 
passed/returned by value. Since this type is an owning RAII wrapper, it should 
be non-copyable (and typically non-movable unless move is carefully 
implemented).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to