🐛 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
+3
View File
@@ -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;