summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gjs/jsapi-util-string.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 5ddc32db..b08d902f 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -96,15 +96,8 @@ gjs_string_from_utf8(JSContext *context,
JS_BeginRequest(context);
- if (g_mem_is_system_malloc()) {
- /* Avoid a copy - assumes that g_malloc == js_malloc == malloc */
- str = JS_NewUCString(context, u16_string, u16_string_length);
- } else {
- str = JS_NewUCStringCopyN(context,
- (jschar*)u16_string,
- u16_string_length);
- g_free(u16_string);
- }
+ /* Avoid a copy - assumes that g_malloc == js_malloc == malloc */
+ str = JS_NewUCString(context, u16_string, u16_string_length);
if (str && value_p)
*value_p = STRING_TO_JSVAL(str);