fixed memory leaks for strftime_format and rootcommand

This commit is contained in:
Scott Moynes 2002-04-20 15:28:14 +00:00
parent bed4d7c1e5
commit 0a3cfdfcb9

View file

@ -1192,9 +1192,13 @@ void BScreen::load() {
rname.seekp(0); rclass.seekp(0); rname.seekp(0); rclass.seekp(0);
rname << rscreen.str() << "strftimeFormat" << ends; rname << rscreen.str() << "strftimeFormat" << ends;
rclass << rscreen.str() << "StrftimeFormat" << ends; rclass << rscreen.str() << "StrftimeFormat" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
if (resource.strftime_format != NULL) if (resource.strftime_format != NULL){
delete [] resource.strftime_format; delete [] resource.strftime_format;
resource.strftime_format=NULL;
}
if (config.getValue(rname.str(), rclass.str(), s)) {
resource.strftime_format = bstrdup(s.c_str()); resource.strftime_format = bstrdup(s.c_str());
} }
#else // !HAVE_STRFTIME #else // !HAVE_STRFTIME
@ -1233,9 +1237,12 @@ void BScreen::load() {
rname.seekp(0); rclass.seekp(0); rname.seekp(0); rclass.seekp(0);
rname << rscreen.str() << "rootCommand" << ends; rname << rscreen.str() << "rootCommand" << ends;
rclass << rscreen.str() << "RootCommand" << ends; rclass << rscreen.str() << "RootCommand" << ends;
if (config.getValue(rname.str(), rclass.str(), s)) {
if (resource.root_command != NULL) if (resource.root_command != NULL){
delete [] resource.root_command; delete [] resource.root_command;
resource.root_command=NULL;
}
if (config.getValue(rname.str(), rclass.str(), s)) {
resource.root_command = bstrdup(s.c_str()); resource.root_command = bstrdup(s.c_str());
} }