Skip to content

Commit c5d12d5

Browse files
committed
ci: enable sanitizer
1 parent 3cf5963 commit c5d12d5

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/sanitizer_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
- name: Run Tests
5151
working-directory: build
5252
env:
53-
ASAN_OPTIONS: log_path=out.log:detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=0:detect_container_overflow=0
53+
ASAN_OPTIONS: log_path=out.log:detect_leaks=1:symbolize=1:strict_string_checks=1:halt_on_error=1:detect_container_overflow=0
5454
LSAN_OPTIONS: suppressions=${{ github.workspace }}/.github/lsan-suppressions.txt
55-
UBSAN_OPTIONS: log_path=out.log:halt_on_error=0:print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt
55+
UBSAN_OPTIONS: log_path=out.log:halt_on_error=1:print_stacktrace=1:suppressions=${{ github.workspace }}/.github/ubsan-suppressions.txt
5656
run: |
5757
ctest --output-on-failure
5858
- name: Save the test output

test/arrow_test.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ TEST_P(FromArrowSchemaTest, PrimitiveType) {
293293
ASSERT_EQ(field.field_id(), kFieldId);
294294
ASSERT_EQ(field.optional(), param.optional);
295295
ASSERT_EQ(*field.type(), *param.iceberg_type);
296+
297+
// Release the exported schema to avoid memory leak
298+
if (exported_schema.release != nullptr) {
299+
exported_schema.release(&exported_schema);
300+
}
296301
}
297302

298303
INSTANTIATE_TEST_SUITE_P(
@@ -384,6 +389,11 @@ TEST(FromArrowSchemaTest, StructType) {
384389
ASSERT_EQ(str_iceberg_field.field_id(), kStrFieldId);
385390
ASSERT_TRUE(str_iceberg_field.optional());
386391
ASSERT_EQ(str_iceberg_field.type()->type_id(), TypeId::kString);
392+
393+
// Release the exported schema to avoid memory leak
394+
if (exported_schema.release != nullptr) {
395+
exported_schema.release(&exported_schema);
396+
}
387397
}
388398

389399
TEST(FromArrowSchemaTest, ListType) {
@@ -427,6 +437,11 @@ TEST(FromArrowSchemaTest, ListType) {
427437
ASSERT_EQ(element.field_id(), kElemFieldId);
428438
ASSERT_TRUE(element.optional());
429439
ASSERT_EQ(element.type()->type_id(), TypeId::kLong);
440+
441+
// Release the exported schema to avoid memory leak
442+
if (exported_schema.release != nullptr) {
443+
exported_schema.release(&exported_schema);
444+
}
430445
}
431446

432447
TEST(FromArrowSchemaTest, MapType) {
@@ -483,6 +498,11 @@ TEST(FromArrowSchemaTest, MapType) {
483498
ASSERT_EQ(value.field_id(), kValueFieldId);
484499
ASSERT_TRUE(value.optional());
485500
ASSERT_EQ(value.type()->type_id(), TypeId::kInt);
501+
502+
// Release the exported schema to avoid memory leak
503+
if (exported_schema.release != nullptr) {
504+
exported_schema.release(&exported_schema);
505+
}
486506
}
487507

488508
} // namespace iceberg

0 commit comments

Comments
 (0)