lidavidm commented on code in PR #4396:
URL: https://github.com/apache/arrow-adbc/pull/4396#discussion_r3410631956


##########
java/driver/jni/src/main/cpp/jni_wrapper.cc:
##########
@@ -328,13 +328,19 @@ 
Java_org_apache_arrow_adbc_driver_jni_impl_NativeAdbc_openDatabase(
     jobjectArray parameters) {
   AdbcErrorGuard error_guard;
   try {
+    jclass nativeHandleKlass = RequireImplClass(env, "NativeDatabaseHandle");
+    jmethodID nativeHandleCtor = RequireMethod(env, nativeHandleKlass, 
"<init>", "(J)V");
+
     auto db = std::make_unique<struct AdbcDatabase>();
     std::memset(db.get(), 0, sizeof(struct AdbcDatabase));
 
     CHECK_ADBC_ERROR(AdbcDatabaseNew(db.get(), &error_guard.error), 
error_guard.error);
-    CHECK_ADBC_ERROR(AdbcDriverManagerDatabaseSetLoadFlags(
-                         db.get(), ADBC_LOAD_FLAG_DEFAULT, &error_guard.error),
-                     error_guard.error);
+    auto result = AdbcDriverManagerDatabaseSetLoadFlags(db.get(), 
ADBC_LOAD_FLAG_DEFAULT,
+                                                        &error_guard.error);
+    if (result != ADBC_STATUS_OK) {
+      std::ignore = AdbcDatabaseRelease(db.get(), nullptr);
+    }

Review Comment:
   (std::ignore is in `<utility>`)



-- 
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