зеркало из https://github.com/mozilla/gecko-dev.git
Bug 97967 - leak of nsLocalFile on failure. Patch by dbaron, r=dbradley, sr=jband
This commit is contained in:
Родитель
4d5175753d
Коммит
3305314761
|
@ -1136,20 +1136,25 @@ mozJSComponentLoader::GlobalForLocation(const char *aLocation,
|
|||
|
||||
nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(component);
|
||||
|
||||
if (!localFile)
|
||||
return nsnull;
|
||||
|
||||
char *location; // declare before first jump to out:
|
||||
jsval retval;
|
||||
nsXPIDLCString displayPath;
|
||||
FILE* fileHandle;
|
||||
JSScript *script = nsnull;
|
||||
|
||||
if (!localFile) {
|
||||
global = nsnull;
|
||||
goto out;
|
||||
}
|
||||
|
||||
localFile->GetURL(getter_Copies(displayPath));
|
||||
rv = localFile->OpenANSIFileDesc("r", &fileHandle);
|
||||
if (NS_FAILED(rv))
|
||||
return nsnull;
|
||||
if (NS_FAILED(rv)) {
|
||||
global = nsnull;
|
||||
goto out;
|
||||
}
|
||||
|
||||
JSScript *script =
|
||||
script =
|
||||
JS_CompileFileHandleForPrincipals(cx, global,
|
||||
(const char *)displayPath,
|
||||
fileHandle, jsPrincipals);
|
||||
|
|
Загрузка…
Ссылка в новой задаче