Skip to content

Commit 07d7cad

Browse files
Remove unnecessary uses of break_handle. (#5256)
In the first case, `array_schema` is an output parameter that has not been yet allocated. In the second case, allocating the schema handle is the last thing we do and the exception handler serves no purpose. Thanks to @bekadavis9 for finding this. --- TYPE: NO_HISTORY Co-authored-by: Rebekah Davis <[email protected]>
1 parent 86db7e3 commit 07d7cad

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

tiledb/sm/c_api/tiledb.cc

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,6 @@ int32_t tiledb_array_get_schema(
16721672
if (!st.ok()) {
16731673
LOG_STATUS_NO_RETURN_VALUE(st);
16741674
save_error(ctx, st);
1675-
tiledb_array_schema_t::break_handle(*array_schema);
16761675
return TILEDB_ERR;
16771676
}
16781677
*array_schema = tiledb_array_schema_t::make_handle(array_schema_get.value());
@@ -2509,18 +2508,14 @@ int32_t tiledb_deserialize_array_schema(
25092508
ensure_output_pointer_is_valid(array_schema);
25102509

25112510
// Create array schema struct
2512-
try {
2513-
auto memory_tracker = ctx->resources().create_memory_tracker();
2514-
memory_tracker->set_type(sm::MemoryTrackerType::ARRAY_LOAD);
2515-
auto shared_schema = tiledb::sm::serialization::array_schema_deserialize(
2516-
(tiledb::sm::SerializationType)serialize_type,
2517-
buffer->buffer(),
2518-
memory_tracker);
2519-
*array_schema = tiledb_array_schema_t::make_handle(shared_schema);
2520-
} catch (...) {
2521-
tiledb_array_schema_t::break_handle(*array_schema);
2522-
throw;
2523-
}
2511+
auto memory_tracker = ctx->resources().create_memory_tracker();
2512+
memory_tracker->set_type(sm::MemoryTrackerType::ARRAY_LOAD);
2513+
auto shared_schema = tiledb::sm::serialization::array_schema_deserialize(
2514+
(tiledb::sm::SerializationType)serialize_type,
2515+
buffer->buffer(),
2516+
memory_tracker);
2517+
2518+
*array_schema = tiledb_array_schema_t::make_handle(shared_schema);
25242519

25252520
return TILEDB_OK;
25262521
}

0 commit comments

Comments
 (0)