Merge pull request #3142 from henricm/fix-for-win-mono_string_to_utf8
authormonojenkins <jo.shields+jenkins@xamarin.com>
Thu, 9 Jun 2016 16:55:12 +0000 (17:55 +0100)
committermonojenkins <jo.shields+jenkins@xamarin.com>
Thu, 9 Jun 2016 16:55:12 +0000 (17:55 +0100)
Using mono_marshal_free n mono_string_builder_to_utf8

`mono_string_builder_to_utf16` is allocating using `mono_marshal_alloc` which, on windows, allocates memory using `CoTaskMemAlloc`. This buffer was then released in `mono_string_builder_to_utf8` using `g_free` which resulted in a crash since that's a different memory on windows. The fix in this PR makes sure `mono_marshal_free` is called instead which has the correct behaviour and results in a `CoTaskMemFree` on windows.

1  2 
mono/metadata/marshal.c

Simple merge