diff --git a/onnxruntime/test/unittest_main/test_main.cc b/onnxruntime/test/unittest_main/test_main.cc index b558a7f00f7bc..1b61530645fb1 100644 --- a/onnxruntime/test/unittest_main/test_main.cc +++ b/onnxruntime/test/unittest_main/test_main.cc @@ -93,6 +93,8 @@ int TEST_MAIN(int argc, char** argv) { ORT_TRY { ortenv_setup(); + // TODO: Fix the C API issue + atexit(ortenv_teardown); // If we don't do this, it will crash ::testing::InitGoogleTest(&argc, argv); status = RUN_ALL_TESTS(); @@ -104,9 +106,6 @@ int TEST_MAIN(int argc, char** argv) { }); } - // TODO: Fix the C API issue - ortenv_teardown(); // If we don't do this, it will crash - #ifndef USE_ONNXRUNTIME_DLL // make memory leak checker happy ::google::protobuf::ShutdownProtobufLibrary();