From 5946f557e5a8629ecea7e892e001e11fd503e26c Mon Sep 17 00:00:00 2001 From: "brendan%mozilla.org" Date: Tue, 30 Dec 2003 07:54:09 +0000 Subject: [PATCH] Don't JS_ReportOutOfMemory while holding script_filename_table_lock (r=self). --- js/src/jsscript.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/src/jsscript.c b/js/src/jsscript.c index 5d7f9dfa5517..504cbbd6dbf8 100644 --- a/js/src/jsscript.c +++ b/js/src/jsscript.c @@ -984,16 +984,19 @@ js_SaveScriptFilename(JSContext *cx, const char *filename) sft_savings += strlen(sfe->filename); #endif if (!sfe) { - /* XXX this assumes NULL puns as JS_FALSE in the mark byte... */ sfe = (ScriptFilenameEntry *) JS_HashTableRawAdd(table, hep, hash, filename, NULL); - if (sfe) + if (sfe) { sfe->key = strcpy(sfe->filename, filename); - else - JS_ReportOutOfMemory(cx); + JS_ASSERT(!sfe->mark); + } } JS_RELEASE_LOCK(script_filename_table_lock); - return sfe ? sfe->filename : NULL; + if (!sfe) { + JS_ReportOutOfMemory(cx); + return NULL; + } + return sfe->filename; } void