hedgewars/uTeams.pas
changeset 4881 35e6269227b6
parent 4514 c62e6e522849
child 4889 f71e30eb1d37
--- a/hedgewars/uTeams.pas	Sat Jan 29 17:40:45 2011 +0100
+++ b/hedgewars/uTeams.pas	Sat Jan 29 18:18:44 2011 +0100
@@ -529,11 +529,17 @@
 end;
 
 procedure freeModule;
-var i: LongWord;
+var i, h: LongWord;
 begin
    if TeamsCount > 0 then
      begin
-     for i:= 0 to Pred(TeamsCount) do Dispose(TeamsArray[i]);
+     for i:= 0 to Pred(TeamsCount) do
+        begin
+            for h:= 0 to cMaxHHIndex do
+                if TeamsArray[i]^.Hedgehogs[h].GearHidden <> nil then
+                    Dispose(TeamsArray[i]^.Hedgehogs[h].GearHidden);
+            Dispose(TeamsArray[i]);
+        end;
      for i:= 0 to Pred(ClansCount) do Dispose(ClansArray[i]);
      end;
    TeamsCount:= 0;