Skip to content

Commit

Permalink
Merge pull request #409 from Bykiev/FixMemoryLeak
Browse files Browse the repository at this point in the history
Fix memory leak in VerticalMetricsTable
  • Loading branch information
JimBobSquarePants authored Aug 1, 2024
2 parents 92a4f32 + baca1eb commit 165a348
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/SixLabors.Fonts/BigEndianBinaryReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SixLabors.Fonts;
/// BinaryReader using big-endian encoding.
/// </summary>
[DebuggerDisplay("Start: {StartOfStream}, Position: {BaseStream.Position}")]
internal class BigEndianBinaryReader : IDisposable
internal sealed class BigEndianBinaryReader : IDisposable
{
/// <summary>
/// Buffer used for temporary storage before conversion into primitives
Expand Down
5 changes: 4 additions & 1 deletion src/SixLabors.Fonts/Tables/General/VerticalMetricsTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ internal short GetTopSideBearing(int glyphIndex)
return null;
}

return Load(binaryReader, headTable.NumberOfVMetrics, profileTable.GlyphCount);
using (binaryReader)
{
return Load(binaryReader, headTable.NumberOfVMetrics, profileTable.GlyphCount);
}
}

public static VerticalMetricsTable Load(BigEndianBinaryReader reader, int metricCount, int glyphCount)
Expand Down

0 comments on commit 165a348

Please sign in to comment.