From d93e11e4152da5563d43947a458dd6b478bd8601 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 12 Jul 2016 16:29:59 -0500 Subject: [PATCH] Delete memory from TUnixSystem::ExpandPathName call The pointer returned from TUnixSystem::ExpandPathName must be deleted by the caller. --- IOPool/Input/src/RootInputFileSequence.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/IOPool/Input/src/RootInputFileSequence.cc b/IOPool/Input/src/RootInputFileSequence.cc index defc0e8f5b78e..6a0ca6a7944a1 100644 --- a/IOPool/Input/src/RootInputFileSequence.cc +++ b/IOPool/Input/src/RootInputFileSequence.cc @@ -235,14 +235,17 @@ namespace edm { std::list originalInfo; try { std::unique_ptr sentry(input ? std::make_unique(*input, lfn_, usedFallback_) : nullptr); - filePtr = std::make_shared(gSystem->ExpandPathName(fileName().c_str()), " Initiating request to open file ", inputType); + std::unique_ptr name(gSystem->ExpandPathName(fileName().c_str()));; + filePtr = std::make_shared(name.get(), " Initiating request to open file ", inputType); } catch (cms::Exception const& e) { if(!skipBadFiles) { if(hasFallbackUrl) { std::ostringstream out; out << e.explainSelf(); - std::string pfn(gSystem->ExpandPathName(fallbackFileName().c_str())); + + std::unique_ptr name(gSystem->ExpandPathName(fallbackFileName().c_str())); + std::string pfn(name.get()); InputFile::reportFallbackAttempt(pfn, logicalFileName(), out.str()); originalInfo = e.additionalInfo(); } else { @@ -260,8 +263,8 @@ namespace edm { try { usedFallback_ = true; std::unique_ptr sentry(input ? std::make_unique(*input, lfn_, usedFallback_) : nullptr); - std::string fallbackFullName = gSystem->ExpandPathName(fallbackFileName().c_str()); - filePtr.reset(new InputFile(fallbackFullName.c_str(), " Fallback request to file ", inputType)); + std::unique_ptr fallbackFullName(gSystem->ExpandPathName(fallbackFileName().c_str())); + filePtr.reset(new InputFile(fallbackFullName.get(), " Fallback request to file ", inputType)); } catch (cms::Exception const& e) { if(!skipBadFiles) {