🐛 Free the statics decode buffer on malformed data
The constructor leaked its temporary stream when decoding raised on corrupt static data.
This commit is contained in:
+8
-5
@@ -183,11 +183,14 @@ begin
|
||||
begin
|
||||
AData.Position := AIndex.Lookup;
|
||||
block := TMemoryStream.Create;
|
||||
block.CopyFrom(AData, AIndex.Size);
|
||||
block.Position := 0;
|
||||
for i := 1 to (AIndex.Size div 7) do
|
||||
FItems.Add(TStaticItem.Create(Self, block, AX, AY));
|
||||
block.Free;
|
||||
try
|
||||
block.CopyFrom(AData, AIndex.Size);
|
||||
block.Position := 0;
|
||||
for i := 1 to (AIndex.Size div 7) do
|
||||
FItems.Add(TStaticItem.Create(Self, block, AX, AY));
|
||||
finally
|
||||
block.Free;
|
||||
end;
|
||||
end;
|
||||
FChanged := False;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user