Browse Source

Fix memory leak in BitmapEncoder

Former-commit-id: 064795cce7107001df5fd8adc610b7d8d19ef7dc
Former-commit-id: d142c5bd63ad62e9307f80d42765d21d3a37e5e3
Former-commit-id: 9448861fae461c940d7fb493a44960c1f6238f13
af/merge-core
James Jackson-South 11 years ago
parent
commit
3ca60efc9b
  1. 6
      src/ImageProcessor/Formats/Bmp/BmpEncoder.cs

6
src/ImageProcessor/Formats/Bmp/BmpEncoder.cs

@ -51,8 +51,8 @@ namespace ImageProcessor.Formats
rowWidth += 4 - amount; rowWidth += 4 - amount;
} }
BinaryWriter writer = new BinaryWriter(stream); using (BinaryWriter writer = new BinaryWriter(stream))
{
BmpFileHeader fileHeader = new BmpFileHeader BmpFileHeader fileHeader = new BmpFileHeader
{ {
Type = 19778, // BM Type = 19778, // BM
@ -81,6 +81,7 @@ namespace ImageProcessor.Formats
writer.Flush(); writer.Flush();
} }
}
/// <summary> /// <summary>
/// Writes the pixel data to the binary stream. /// Writes the pixel data to the binary stream.
@ -100,6 +101,7 @@ namespace ImageProcessor.Formats
amount = 4 - amount; amount = 4 - amount;
} }
// TODO: Make this parallel.
for (int y = image.Height - 1; y >= 0; y--) for (int y = image.Height - 1; y >= 0; y--)
{ {
for (int x = 0; x < image.Width; x++) for (int x = 0; x < image.Width; x++)

Loading…
Cancel
Save