]> Dogcows Code - chaz/openbox/commitdiff
fixed memory leaks for strftime_format and rootcommand
authorScott Moynes <smoynes@nexus.carleton.ca>
Sat, 20 Apr 2002 15:28:14 +0000 (15:28 +0000)
committerScott Moynes <smoynes@nexus.carleton.ca>
Sat, 20 Apr 2002 15:28:14 +0000 (15:28 +0000)
src/Screen.cc

index 8ad57376735dadbf9df1e8ab23c7f548307e716b..0548f5acb5e8f86fc256689cf0efd8534e721396 100644 (file)
@@ -1192,9 +1192,13 @@ void BScreen::load() {
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "strftimeFormat" << ends;
   rclass << rscreen.str() << "StrftimeFormat" << ends;
+
+  if (resource.strftime_format != NULL){
+    delete [] resource.strftime_format;
+    resource.strftime_format=NULL;
+  }
+
   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
@@ -1233,9 +1237,12 @@ void BScreen::load() {
   rname.seekp(0); rclass.seekp(0);
   rname << rscreen.str() << "rootCommand" << ends;
   rclass << rscreen.str() << "RootCommand" << ends;
+
+  if (resource.root_command != NULL){
+    delete [] resource.root_command;
+    resource.root_command=NULL;
+  }
   if (config.getValue(rname.str(), rclass.str(), s)) {
-    if (resource.root_command != NULL)
-      delete [] resource.root_command;
     resource.root_command = bstrdup(s.c_str());
   }
 
This page took 0.023911 seconds and 4 git commands to generate.