-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Missing call to FreeHGlobal to free memory
$Data.cbStruct = $WINTRUST_DATA::GetSize()
! $Data.pData = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($Size)
$Data.dwUIChoice = $WTD_UI::None
[System.Runtime.InteropServices.Marshal]::StructureToPtr($Info, $Data.pData, $false)
$SUCCESS = $wintrust::WinVerifyTrust($WindowHandle, [ref]$ActionID, [ref]$Data)
if($SUCCESS -eq 0)
{
Write-Output $true
}
else
{
if(($SUCCESS -eq 0x80096010) -or ($SUCCESS -eq 0x800b0100))
{
Write-Output $false
}
else
{
! no call to FreeHGlobal in exception path
throw ([ComponentModel.Win32Exception]$SUCCESS).Message
}
}
! no call to FreeHGlobal | $Data.pData = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($Size) |
Similar issue here with missing FreeHGlobal for AllocHGlobal call:
| $lpLuid = [System.Runtime.InteropServices.Marshal]::AllocHGlobal($LUID::GetSize()) |
Ditto:
| $AtomName = [System.Runtime.InteropServices.Marshal]::AllocHGlobal(1024) |
Similar issue in the paths that throw exceptions in GetIpNetTable.ps1:
elseif($SUCCESS -eq $ERROR_NO_DATA)
{
Write-Output $null
}
else
{
throw "[GetIpNetTable] Error: $($SUCCESS)"
! leak due to failure to call FreeHGlobal($pIpNetTable)
}
}
else
{
throw "[GetIpNetTable] Error: $($SUCCESS)"
! leak due to failure to call FreeHGlobal($pIpNetTable)
}
[System.Runtime.InteropServices.Marshal]::FreeHGlobal($pIpNetTable)
}| [System.Runtime.InteropServices.Marshal]::FreeHGlobal($pIpNetTable) |
Might want to do a pass through the repo for these.
Metadata
Metadata
Assignees
Labels
No labels