Skip to content

Commit

Permalink
[LLVM Analyzer] Avoid storing pointer to a temporary string's interna…
Browse files Browse the repository at this point in the history
…l buffer
  • Loading branch information
iarspider committed Oct 11, 2024
1 parent 6d26b89 commit ce52df2
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ std::unique_ptr<SiPixelGenErrorDBObject> SiPixelFakeGenErrorDBObjectESSource::pr
SiPixelGenErrorDBObject* obj = new SiPixelGenErrorDBObject;

// Local variables
const char* tempfile;
int m;

// Set the number of GenErrors to be passed to the dbobject
Expand All @@ -35,9 +34,7 @@ std::unique_ptr<SiPixelGenErrorDBObject> SiPixelFakeGenErrorDBObjectESSource::pr
// open the GenError file(s)
for (m = 0; m < obj->numOfTempl(); ++m) {
edm::FileInPath file(GenErrorCalibrations_[m].c_str());
tempfile = (file.fullPath()).c_str();

std::ifstream in_file(tempfile, std::ios::in);
std::ifstream in_file(file.fullPath(), std::ios::in);

if (in_file.is_open()) {
edm::LogInfo("SiPixelFakeGenErrorDBObjectESSource")
Expand Down Expand Up @@ -84,7 +81,7 @@ std::unique_ptr<SiPixelGenErrorDBObject> SiPixelFakeGenErrorDBObjectESSource::pr
in_file.close();
} else {
// If file didn't open, report this
edm::LogError("SiPixeFakelGenErrorDBObjectESSource") << "Error opening File" << tempfile << std::endl;
edm::LogError("SiPixeFakelGenErrorDBObjectESSource") << "Error opening File" << file.fullPath() << std::endl;
}
}

Expand Down

0 comments on commit ce52df2

Please sign in to comment.