Dispose of the memory stream in Helper class

Disposes of the memory stream created in the server's helper class that
converts an image.
This commit is contained in:
yankejustin 2015-03-17 18:35:53 -04:00
parent 79f9ca0cba
commit c6b57f8110
1 changed files with 5 additions and 3 deletions

View File

@ -29,9 +29,11 @@ public static string GetRandomName(int length)
public static Image CByteToImg(byte[] img)
{
MemoryStream ms = new MemoryStream(img, 0, img.Length);
ms.Write(img, 0, img.Length);
return Image.FromStream(ms, true);
using (MemoryStream ms = new MemoryStream(img, 0, img.Length))
{
ms.Write(img, 0, img.Length);
return Image.FromStream(ms, true);
}
}
public static string GetFileSize(long size)