Fix accessing to freed memory
authorunc0rr
Fri, 21 Mar 2008 20:34:48 +0000
changeset 817 7069f18517e9
parent 816 235d56fe19f4
child 818 635e58295079
Fix accessing to freed memory
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Thu Mar 20 23:44:19 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Fri Mar 21 20:34:48 2008 +0000
@@ -1033,6 +1033,7 @@
 
 procedure doStepParachute(Gear: PGear);
 var HHGear: PGear;
+    Timer: Longword;
 begin
 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
 HHGear^.State:= HHGear^.State and not gstAttacking;
@@ -1052,8 +1053,9 @@
         State:= State and not (gstAttacking or gstAttacked);
         State:= State or gstMoving;
         end;
+   Timer:= Gear^.Timer;
    DeleteGear(Gear);
-   if Gear^.Timer > 10 then
+   if Timer > 10 then
       begin
       OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
       ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^)