Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,6 @@ private static unsafe int AlpnServerSelectCallback(IntPtr ssl, byte** outp, byte
return Ssl.SSL_TLSEXT_ERR_ALERT_FATAL;
}

// reset application data to avoid dangling pointer.
Ssl.SslSetData(ssl, IntPtr.Zero);

GCHandle protocolHandle = GCHandle.FromIntPtr(sslData);
if (!(protocolHandle.Target is List<SslApplicationProtocol> protocolList))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,6 @@ protected override void Dispose(bool disposing)
_writeBio?.Dispose();
}

if (AlpnHandle.IsAllocated)
{
Interop.Ssl.SslSetData(handle, IntPtr.Zero);
AlpnHandle.Free();
}

base.Dispose(disposing);
}

Expand All @@ -438,6 +432,12 @@ protected override bool ReleaseHandle()

SslContextHandle?.DangerousRelease();

if (AlpnHandle.IsAllocated)
{
Interop.Ssl.SslSetData(handle, IntPtr.Zero);
AlpnHandle.Free();
}

IntPtr h = handle;
SetHandle(IntPtr.Zero);
Interop.Ssl.SslDestroy(h); // will free the handles underlying _readBio and _writeBio
Expand Down