bug 617215 - eliminating JS_NewString usage in FF while fixing a leak there. r=bz

This commit is contained in:
Igor Bukanov
2010-12-09 11:22:15 +01:00
parent b79065f341
commit 32e44f7d15
9 changed files with 44 additions and 50 deletions

View File

@@ -2355,11 +2355,10 @@ date_toSource(JSContext *cx, uintN argc, Value *vp)
return JS_FALSE;
}
str = JS_NewString(cx, bytes, strlen(bytes));
if (!str) {
js_free(bytes);
str = JS_NewStringCopyZ(cx, bytes);
js_free(bytes);
if (!str)
return JS_FALSE;
}
vp->setString(str);
return JS_TRUE;
}