# HG changeset patch
# User nemo
# Date 1269280799 0
# Node ID d54b2c718971fb8e1cd7579c436c24be35ff8809
# Parent  41732f986b4f63e113c1d909e751e736b68ec7e9
Remove doubled call of freeEverything. restore freeing of LandBackSurface pending unc0rr explaining why 'sactly he took it out (assuming an error right now)

diff -r 41732f986b4f -r d54b2c718971 hedgewars/hwengine.pas
--- a/hedgewars/hwengine.pas	Mon Mar 22 17:48:19 2010 +0000
+++ b/hedgewars/hwengine.pas	Mon Mar 22 17:59:59 2010 +0000
@@ -570,10 +570,16 @@
     GetParams();
     Randomize();
 
-    if GameType = gmtLandPreview then GenLandPreview()
+    if GameType = gmtLandPreview then
+        begin
+{$IFDEF HWLIBRARY}
+        // initEverything();   TODO - Koda, please check to see if this is appropriate here
+{$ENDIF}
+        GenLandPreview();
+        // freeEverything()    TODO - Koda, please check if this is also needed here. 
+        end
     else if GameType = gmtSyntax then DisplayUsage()
     else Game();
-    freeEverything();
     
     if GameType = gmtSyntax then
         ExitCode:= 1
diff -r 41732f986b4f -r d54b2c718971 hedgewars/uLand.pas
--- a/hedgewars/uLand.pas	Mon Mar 22 17:48:19 2010 +0000
+++ b/hedgewars/uLand.pas	Mon Mar 22 17:59:59 2010 +0000
@@ -862,6 +862,8 @@
 procedure freeModule;
 begin
     FillChar(LandPixels, sizeof(TLandArray), 0);
+    // TODO - Find out why unc0rr removed this since it will leak
+    if LandBackSurface <> nil then SDL_FreeSurface(LandBackSurface);
 end;
 
 end.