| File: System\Security\Cryptography\X509Certificates\SafeLocalAllocHandle.cs | Web Access |
| Project: src\runtime\src\libraries\System.Security.Cryptography\src\System.Security.Cryptography.csproj (System.Security.Cryptography) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; namespace System.Security.Cryptography.X509Certificates { /// <summary> /// SafeHandle for LocalAlloc'd memory. /// </summary> internal sealed class SafeLocalAllocHandle : SafeCrypt32Handle<SafeLocalAllocHandle> { public static SafeLocalAllocHandle Create(int cb) { var h = new SafeLocalAllocHandle(); h.SetHandle(Marshal.AllocHGlobal(cb)); return h; } protected sealed override bool ReleaseHandle() { Marshal.FreeHGlobal(handle); return true; } } }