- memleak fix and menu fix from MatzeB
[supertux.git] / src / level.cpp
index ea04cf1..4bdf1b4 100644 (file)
@@ -127,6 +127,7 @@ void st_subset::load(char *subset)
 
         }
 
+      lisp_free(root_obj);
       fclose(fi);
 
       snprintf(str, 1024, "%s.png", filename);
@@ -203,6 +204,7 @@ void st_subset::free()
 Level::Level()
   : img_bkgd(0)
 {
+  init_defaults();
 }
 
 Level::Level(const std::string& subset, int level)
@@ -501,6 +503,7 @@ Level::load(const std::string& filename)
   else
     endpos = 32*(width-15);
 
+  lisp_free(root_obj);
   fclose(fi);
   return 0;
 }
@@ -635,8 +638,7 @@ Level::load_gfx()
     }
   else
     {
-      /* Quick hack to make sure an image is loaded, when we are freeing it afterwards. */
-      load_image(&img_bkgd, theme,"solid0.png", IGNORE_ALPHA);
+      img_bkgd = 0;
     }
 }