Fix double-destroy on js_SetLastIndex failure in js_NewRegExpObject (332415, r=mrbkap).

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@193360 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org
2006-04-01 00:01:20 +00:00
parent 469fb6f9bb
commit e6fce34718

View File

@@ -4116,10 +4116,12 @@ js_NewRegExpObject(JSContext *cx, JSTokenStream *ts,
return NULL;
JS_PUSH_SINGLE_TEMP_ROOT(cx, STRING_TO_JSVAL(str), &tvr);
obj = js_NewObject(cx, &js_RegExpClass, NULL, NULL);
if (!obj || !JS_SetPrivate(cx, obj, re) || !js_SetLastIndex(cx, obj, 0)) {
if (!obj || !JS_SetPrivate(cx, obj, re)) {
js_DestroyRegExp(cx, re);
obj = NULL;
}
if (obj && !js_SetLastIndex(cx, obj, 0))
obj = NULL;
JS_POP_TEMP_ROOT(cx, &tvr);
return obj;
}