Skip to content

Commit 935c4a9

Browse files
committed
Fix leaky allocation in text rendering
1 parent ac07e45 commit 935c4a9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/ImageSharp.Drawing/Shapes/Rasterization/PolygonScanner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static PolygonScanner Create(
9898
IntersectionRule intersectionRule,
9999
MemoryAllocator allocator)
100100
{
101-
var multipolygon = TessellatedMultipolygon.Create(polygon, allocator);
101+
using var multipolygon = TessellatedMultipolygon.Create(polygon, allocator);
102102
var edges = ScanEdgeCollection.Create(multipolygon, allocator, subsampling);
103103
var scanner = new PolygonScanner(edges, multipolygon.TotalVertexCount * 2, minY, maxY, subsampling, intersectionRule, allocator);
104104
scanner.Init();

src/ImageSharp.Drawing/Shapes/Rasterization/ScanEdgeCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static ScanEdgeCollection Create(
4040
MemoryAllocator allocator,
4141
int subsampling)
4242
{
43-
TessellatedMultipolygon multipolygon = TessellatedMultipolygon.Create(polygon, allocator);
43+
using TessellatedMultipolygon multipolygon = TessellatedMultipolygon.Create(polygon, allocator);
4444
return Create(multipolygon, allocator, subsampling);
4545
}
4646
}

0 commit comments

Comments
 (0)