fix a small leak
authorkoda
Sun, 21 Mar 2010 20:55:45 +0000
changeset 3041 177b2b273d4a
parent 3040 3e7f4a30e18a
child 3042 872e5b3de293
fix a small leak
hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Sun Mar 21 20:54:18 2010 +0000
+++ b/hedgewars/uStore.pas	Sun Mar 21 20:55:45 2010 +0000
@@ -217,7 +217,7 @@
         r.h:= 19;
 
         DrawRoundRect(@r, cWhiteColor, cNearBlackColor, texsurf, true);
-
+        
         // overwrite flag for cpu teams and keep players from using it
         if (Hedgehogs[0].Gear <> nil) and (Hedgehogs[0].BotLevel > 0) then
             Flag:= 'cpu'
@@ -238,7 +238,9 @@
         PLongwordArray(texsurf^.pixels)^[32 * 16 + 23]:= cNearBlackColor;
 
         FlagTex:= Surface2Tex(texsurf, false);
-        
+        SDL_FreeSurface(texsurf);
+        texsurf:= nil;
+
         dec(drY, r.h + 2);
         DrawHealthY:= drY;
         for i:= 0 to 7 do
@@ -248,11 +250,10 @@
                     NameTagTex:= RenderStringTex(Name, Clan^.Color, CheckCJKFont(Name,fnt16));
                     if Hat <> 'NoHat' then
                         begin
-                        texsurf:= nil;
                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
-                           texsurf:= LoadImage(Pathz[ptHats] + '/Reserved/' + Copy(Hat,9,Length(s)-8), ifNone)
+                            texsurf:= LoadImage(Pathz[ptHats] + '/Reserved/' + Copy(Hat,9,Length(s)-8), ifNone)
                         else
-                           texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, ifNone);
+                            texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, ifNone);
                         if texsurf <> nil then
                             begin
                             HatTex:= Surface2Tex(texsurf, true);