diff --git a/tree/tree/test/BulkApiVarLength.cxx b/tree/tree/test/BulkApiVarLength.cxx index 025925c3cf05a..2654b6485fe0d 100644 --- a/tree/tree/test/BulkApiVarLength.cxx +++ b/tree/tree/test/BulkApiVarLength.cxx @@ -72,13 +72,13 @@ constexpr Long64_t BulkApiVariableTest::fEventCount; TEST_F(BulkApiVariableTest, stdRead) { - auto hfile = TFile::Open(fFileName.c_str()); + std::unique_ptr hfile{TFile::Open(fFileName.c_str())}; printf("Starting read of file %s.\n", fFileName.c_str()); TStopwatch sw; printf("Using standard read APIs.\n"); - TTreeReader myReader("T", hfile); + TTreeReader myReader("T", hfile.get()); TTreeReaderArray myF(myReader, "f"); TTreeReaderArray myD(myReader, "d"); TTreeReaderValue myI(myReader, "myLen"); @@ -126,8 +126,7 @@ TEST_F(BulkApiVariableTest, stdRead) } ev++; } - ASSERT_EQ(ev, events+1); - delete hfile; + ASSERT_EQ(ev, events + 1); sw.Stop(); printf("TTreeReader: Successful read of all events.\n"); @@ -136,7 +135,7 @@ TEST_F(BulkApiVariableTest, stdRead) TEST_F(BulkApiVariableTest, serializedRead) { - auto hfile = TFile::Open(fFileName.c_str()); + std::unique_ptr hfile{TFile::Open(fFileName.c_str())}; printf("Starting read of file %s.\n", fFileName.c_str()); TStopwatch sw;