summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8/V8NPUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/v8/V8NPUtils.cpp')
-rw-r--r--WebCore/bindings/v8/V8NPUtils.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/WebCore/bindings/v8/V8NPUtils.cpp b/WebCore/bindings/v8/V8NPUtils.cpp
index 8fa19d7..4fb0456 100644
--- a/WebCore/bindings/v8/V8NPUtils.cpp
+++ b/WebCore/bindings/v8/V8NPUtils.cpp
@@ -65,8 +65,9 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP
VOID_TO_NPVARIANT(*result);
else if (object->IsString()) {
v8::String::Utf8Value utf8(object);
- char* utf8_chars = strdup(*utf8);
- STRINGN_TO_NPVARIANT(utf8_chars, utf8.length(), *result);
+ char* utf8Chars = reinterpret_cast<char*>(malloc(utf8.length()));
+ memcpy(utf8Chars, *utf8, utf8.length());
+ STRINGN_TO_NPVARIANT(utf8Chars, utf8.length(), *result);
} else if (object->IsObject()) {
DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext());
NPObject* npobject = npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(object), window);