
This snippet is from the file _baseoverlappedasyncresult.cs in the SSCLI project (aka Rotor). This function is used in the Base Class Library of the .NET Framework.
private void InternalFree()
{
m_Overlapped = null;
m_PinnedObjects = null;
if (m_NativeOverlapped != IntPtr.Zero)
{
unsafe
{
Overlapped.Free((NativeOverlapped*) m_NativeOverlapped);
}
m_NativeOverlapped = IntPtr.Zero;
}
}
In this snippet is a bug that eluded Microsoft’s many static analysis tools (RaceTrack, Spec#, etc). See if you can find it.