Increase the reliability of QueryCredentialsAttribute_Name usage by wrapping a try-finally around the allocation that happens inside the CER.
This commit is contained in:
@@ -156,8 +156,14 @@ namespace NSspi.Credentials
|
||||
|
||||
if( status == SecurityStatus.OK && carrier.Name != IntPtr.Zero )
|
||||
{
|
||||
name = Marshal.PtrToStringUni( carrier.Name );
|
||||
NativeMethods.FreeContextBuffer( carrier.Name );
|
||||
try
|
||||
{
|
||||
name = Marshal.PtrToStringUni( carrier.Name );
|
||||
}
|
||||
finally
|
||||
{
|
||||
NativeMethods.FreeContextBuffer( carrier.Name );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user