*
* Returns: a utf8 string with the contents of the StringBuilder.
*
- * The return value must be released with g_free.
+ * The return value must be released with mono_marshal_free.
*
* This is a JIT icall, it sets the pending exception and returns NULL on error.
*/
if (gerror) {
g_error_free (gerror);
- g_free (str_utf16);
+ mono_marshal_free (str_utf16);
mono_set_pending_exception (mono_get_exception_execution_engine ("Failed to convert StringBuilder from utf16 to utf8"));
return NULL;
} else {
guint len = mono_string_builder_capacity (sb) + 1;
gchar *res = (gchar *)mono_marshal_alloc (len * sizeof (gchar), &error);
if (!mono_error_ok (&error)) {
- g_free (str_utf16);
+ mono_marshal_free (str_utf16);
g_free (tmp);
mono_error_set_pending_exception (&error);
return NULL;
memcpy (res, tmp, str_len * sizeof (gchar));
res[str_len] = '\0';
- g_free (str_utf16);
+ mono_marshal_free (str_utf16);
g_free (tmp);
return res;
}
*
* Returns: a utf16 string with the contents of the StringBuilder.
*
- * The return value must not be freed.
+ * The return value must be released with mono_marshal_free.
+ *
* This is a JIT icall, it sets the pending exception and returns NULL on error.
*/
gunichar2*