🐛 Free the art decode buffer on malformed data

The constructor leaked its temporary stream whenever a decode
operation raised, for example on truncated or corrupt art data.
This commit is contained in:
2026-11-15 22:06:50 +01:00
parent c1967a8a41
commit ae9136d53a
+4 -1
View File
@@ -91,6 +91,7 @@ begin
begin
AData.Position := AIndex.Lookup;
block := TMemoryStream.Create;
try
block.CopyFrom(AData, AIndex.Size);
block.Position := 0;
@@ -195,7 +196,9 @@ begin
PWordArray(FGraphic.Bits)^[i] := PWordArray(FGraphic.Bits)^[i] xor $8000; //invert alpha bit
end else
FGraphic:= TSingleImage.Create;
if Assigned(block) then block.Free;
finally
block.Free;
end;
end else
begin
FHeader := 1;