]> Dogcows Code - chaz/openbox/commitdiff
fixed memory leak in screen::load()
authorDana Jansens <danakj@orodu.net>
Fri, 19 Apr 2002 21:05:49 +0000 (21:05 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 19 Apr 2002 21:05:49 +0000 (21:05 +0000)
src/Screen.cc

index 445156713b9e4ed51eaf0e13682cf3dec471ab96..8ad57376735dadbf9df1e8ab23c7f548307e716b 100644 (file)
@@ -1192,8 +1192,11 @@ void BScreen::load() {
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "strftimeFormat" << ends;
   rclass << rscreen.str() << "StrftimeFormat" << ends;
-  if (config.getValue(rname.str(), rclass.str(), s))
+  if (config.getValue(rname.str(), rclass.str(), s)) {
+    if (resource.strftime_format != NULL)
+      delete [] resource.strftime_format;
     resource.strftime_format = bstrdup(s.c_str());
+  }
 #else // !HAVE_STRFTIME
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "dateFormat" << ends;
@@ -1230,8 +1233,11 @@ void BScreen::load() {
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "rootCommand" << ends;
   rclass << rscreen.str() << "RootCommand" << ends;
-  if (config.getValue(rname.str(), rclass.str(), s))
+  if (config.getValue(rname.str(), rclass.str(), s)) {
+    if (resource.root_command != NULL)
+      delete [] resource.root_command;
     resource.root_command = bstrdup(s.c_str());
+  }
 
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "opaqueMove" << ends;
This page took 0.026906 seconds and 4 git commands to generate.