Skip to content

Commit

Permalink
fix(java/driver/flightsql): Have InfoMetadataBuilder in a try-with-re…
Browse files Browse the repository at this point in the history
…sources block to prevent VectorSchemaRoot leak
  • Loading branch information
ywc88 committed Sep 14, 2023
1 parent 34b364f commit 5cd8579
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ public AdbcStatement bulkIngest(String targetTableName, BulkIngestMode mode)

@Override
public ArrowReader getInfo(int[] infoCodes) throws AdbcException {
try (final VectorSchemaRoot root =
new InfoMetadataBuilder(allocator, client, infoCodes).build()) {
try (InfoMetadataBuilder builder = new InfoMetadataBuilder(allocator, client, infoCodes)) {
final VectorSchemaRoot root = builder.build();
return RootArrowReader.fromRoot(allocator, root);
} catch (Exception e) {
throw AdbcException.invalidState("[Flight SQL] Failed to get info");
}
}

Expand Down

0 comments on commit 5cd8579

Please sign in to comment.