Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not hold on to empty strings passed to getByLabel [9_4] #25420

Merged
merged 1 commit into from
Dec 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions DataFormats/FWLite/src/DataGetterHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace fwlite {
//
// empty object used to signal that the branch requested was not found
static internal::Data branchNotFound;
static char kEmptyString[1] = {0};

//
// constructors and destructor
Expand Down Expand Up @@ -218,16 +219,16 @@ namespace fwlite {
std::strncpy(newModule,iModuleLabel,moduleLabelLen);
labels_.push_back(newModule);

char* newProduct = const_cast<char*>(key.product());
if(newProduct[0] != 0) {
size_t newProductLen = strlen(newProduct)+1;
char* newProduct = kEmptyString;
if(key.product()[0] != 0) {
size_t newProductLen = strlen(key.product())+1;
newProduct = new char[newProductLen];
std::strncpy(newProduct,key.product(),newProductLen);
labels_.push_back(newProduct);
}
char* newProcess = const_cast<char*>(key.process());
if(newProcess[0]!=0) {
size_t newProcessLen = strlen(newProcess)+1;
char* newProcess = kEmptyString;
if(key.process()[0]!=0) {
size_t newProcessLen = strlen(key.process())+1;
newProcess = new char[newProcessLen];
std::strncpy(newProcess,key.process(),newProcessLen);
labels_.push_back(newProcess);
Expand Down