fix potential memory leak with converting byte arrays to bitmaps
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
Module ModuleHelper
|
||||
Public Function ByteArrayToBitmap(bytearray() As Byte) As Bitmap
|
||||
Return New Bitmap(New System.IO.MemoryStream(bytearray))
|
||||
Try
|
||||
Dim oBitmap As Bitmap
|
||||
|
||||
Using oStream As New IO.MemoryStream(bytearray)
|
||||
oBitmap = New Bitmap(oStream)
|
||||
End Using
|
||||
|
||||
Return oBitmap
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function StringToByteArray(ByVal hex As String) As Byte()
|
||||
|
||||
Reference in New Issue
Block a user