Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash in SafePipeHandle.ReleaseHandle() on Windows (mono#3797)
The ReleaseHandle() methods tries to deallocate the handle as if it was a pointer to heap memory. But on Windows it's a HANDLE. The call to Marshal.FreeHGlobal() causes a crash on Windows. It doesn't crash on other platforms probably due to the emulated handles which are indeed heap allocated memory objects. But the underlying file descriptor is never closed so there should be a file descriptor leak on other platforms. This patch fixes the issue by calling MonoIO.Close() on the handle rather than Marshal.FreeHGlobal()
- Loading branch information