🐛 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:
2026-11-15 22:06:50 +01:00
parent d129a1b94f
commit ee8dfe5adf
+8 -5
View File
@@ -183,11 +183,14 @@ begin
begin begin
AData.Position := AIndex.Lookup; AData.Position := AIndex.Lookup;
block := TMemoryStream.Create; block := TMemoryStream.Create;
block.CopyFrom(AData, AIndex.Size); try
block.Position := 0; block.CopyFrom(AData, AIndex.Size);
for i := 1 to (AIndex.Size div 7) do block.Position := 0;
FItems.Add(TStaticItem.Create(Self, block, AX, AY)); for i := 1 to (AIndex.Size div 7) do
block.Free; FItems.Add(TStaticItem.Create(Self, block, AX, AY));
finally
block.Free;
end;
end; end;
FChanged := False; FChanged := False;
end; end;