🐛 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:
@@ -183,12 +183,15 @@ begin
|
|||||||
begin
|
begin
|
||||||
AData.Position := AIndex.Lookup;
|
AData.Position := AIndex.Lookup;
|
||||||
block := TMemoryStream.Create;
|
block := TMemoryStream.Create;
|
||||||
|
try
|
||||||
block.CopyFrom(AData, AIndex.Size);
|
block.CopyFrom(AData, AIndex.Size);
|
||||||
block.Position := 0;
|
block.Position := 0;
|
||||||
for i := 1 to (AIndex.Size div 7) do
|
for i := 1 to (AIndex.Size div 7) do
|
||||||
FItems.Add(TStaticItem.Create(Self, block, AX, AY));
|
FItems.Add(TStaticItem.Create(Self, block, AX, AY));
|
||||||
|
finally
|
||||||
block.Free;
|
block.Free;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
FChanged := False;
|
FChanged := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user