You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2023/09/18 18:17:24 UTC
[arrow-adbc] branch main updated: fix(java/driver/flight-sql): fix leak in InfoMetadataBuilder (#1070)
This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 040ea97e fix(java/driver/flight-sql): fix leak in InfoMetadataBuilder (#1070)
040ea97e is described below
commit 040ea97e0e51afb1b30c31843df65c11d8b5b74a
Author: Solomon Choe <12...@users.noreply.github.com>
AuthorDate: Mon Sep 18 11:17:19 2023 -0700
fix(java/driver/flight-sql): fix leak in InfoMetadataBuilder (#1070)
If an exception was thrown in InfoMetadataBuilder, the inner
VectorSchemaRoot would leak.
---
.../apache/arrow/adbc/driver/flightsql/FlightSqlConnection.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlConnection.java b/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlConnection.java
index 7d6e7b11..f583f2b8 100644
--- a/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlConnection.java
+++ b/java/driver/flight-sql/src/main/java/org/apache/arrow/adbc/driver/flightsql/FlightSqlConnection.java
@@ -109,9 +109,12 @@ public class FlightSqlConnection implements AdbcConnection {
@Override
public ArrowReader getInfo(int[] infoCodes) throws AdbcException {
- try (final VectorSchemaRoot root =
- new InfoMetadataBuilder(allocator, client, infoCodes).build()) {
- return RootArrowReader.fromRoot(allocator, root);
+ try (InfoMetadataBuilder builder = new InfoMetadataBuilder(allocator, client, infoCodes)) {
+ try (final VectorSchemaRoot root = builder.build()) {
+ return RootArrowReader.fromRoot(allocator, root);
+ }
+ } catch (Exception e) {
+ throw AdbcException.invalidState("[Flight SQL] Failed to get info");
}
}