diff options
author | Zoltan Varga <vargaz@gmail.com> | 2015-03-25 08:29:27 +0300 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2015-03-25 08:31:33 +0300 |
commit | c61bcc925d45125747e4601169dfe2cd9997bce1 (patch) | |
tree | f210b4ad00cf6d4cbb26559a81662f862ca9e9cd /mcs/class/corlib | |
parent | b4d62900089c51086fe7302f52412448cb4ccc2a (diff) |
[runtime] Avoid returning null from Marshal.AllocCoTaskMem () if size is 0. Fixes #28383.
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r-- | mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs b/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs index cecdc6437c2..92675b00f7c 100644 --- a/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs @@ -173,6 +173,14 @@ namespace MonoTests.System.Runtime.InteropServices Marshal.FreeHGlobal (ptr); } + [Test] + public void AllocCoTaskMemZeroSize () + { + IntPtr ptr = Marshal.AllocCoTaskMem (0); + Assert.IsTrue (ptr != IntPtr.Zero); + Marshal.FreeCoTaskMem (ptr); + } + public struct Foo { public int a; public static int b; |