Skip to content

Commit

Permalink
Merge pull request #15181 from Dr15Jones/fixMemoryLeakFromTUnixExpand…
Browse files Browse the repository at this point in the history
…PathName

Delete memory from TUnixSystem::ExpandPathName call
  • Loading branch information
davidlange6 committed Jul 15, 2016
2 parents 2725084 + d93e11e commit 1240629
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions IOPool/Input/src/RootInputFileSequence.cc
Expand Up @@ -235,14 +235,17 @@ namespace edm {
std::list<std::string> originalInfo;
try {
std::unique_ptr<InputSource::FileOpenSentry> sentry(input ? std::make_unique<InputSource::FileOpenSentry>(*input, lfn_, usedFallback_) : nullptr);
filePtr = std::make_shared<InputFile>(gSystem->ExpandPathName(fileName().c_str()), " Initiating request to open file ", inputType);
std::unique_ptr<char[]> name(gSystem->ExpandPathName(fileName().c_str()));;
filePtr = std::make_shared<InputFile>(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<char[]> name(gSystem->ExpandPathName(fallbackFileName().c_str()));
std::string pfn(name.get());
InputFile::reportFallbackAttempt(pfn, logicalFileName(), out.str());
originalInfo = e.additionalInfo();
} else {
Expand All @@ -260,8 +263,8 @@ namespace edm {
try {
usedFallback_ = true;
std::unique_ptr<InputSource::FileOpenSentry> sentry(input ? std::make_unique<InputSource::FileOpenSentry>(*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<char[]> fallbackFullName(gSystem->ExpandPathName(fallbackFileName().c_str()));
filePtr.reset(new InputFile(fallbackFullName.get(), " Fallback request to file ", inputType));
}
catch (cms::Exception const& e) {
if(!skipBadFiles) {
Expand Down

0 comments on commit 1240629

Please sign in to comment.